Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#12067 closed defect (invalid)

cannot "new" an editor when onLoadDeffered arg is set

Reported by: bobgallagher Owned by:
Priority: high Milestone: tbd
Component: Editor Version: 1.5
Keywords: Cc:
Blocked By: Blocking:

Description

I have a tool to generated dojo markup to create a widget. For the editor a test case may generate something like:

  new dijit.Editor({
    style : "width: 500px",
    onLoadDeferred : function(event) {
      dijit.byId('editor').set('value', 
                    dijit.byId('richtext').value);
      }
  }, "editor").startup();

The above will fail with the following error:

editor.onLoadDeferred.addCallback is not a function

The following however does work:

  var w = new dijit.Editor({
    style : "width: 500px"
  }, "editor");
  w.onLoadDeferred.addCallback(function(event) {
      dijit.byId('editor').set('value', 
                    dijit.byId('richtext').value);
  });
  w.startup();

This is inconsistent with other "event handler".

Change History (3)

comment:1 Changed 9 years ago by bill

Resolution: invalid
Status: newclosed

Yes, that's because onLoadDeferred is a dojo.Deferred, not a callback / event handler. I can see how you might have gotten confused since the name starts with "on" but OTOH it ends with "Deferred".

comment:2 Changed 9 years ago by bill

PS: there is a note in RichText.js about possibly making a public onLoad() callback that apps could attach to. However, for 2.0 I think I want to move away from callbacks and use watch() / Deferreds more, so not sure if I will ever make a public onLoad() callback.

comment:3 Changed 9 years ago by bill

(In [23311]) Make documentation of onLoadDeferred a little clearer, refs #12067 !strict.

Note: See TracTickets for help on using tickets.