Dario Dario - 2 months ago 18
Javascript Question

Dojo's dojo/method programmatically?

Is there a way to define a dojo/method programmatically, in a JavaScript function? (Instead of defining it through script type="dojo/method" within a declarative widget, for example.)

Answer Source

Just override it directly on a widget. For example, if you wrote dojo/method for abc, do it like that:

var myWidget = ...;
myWidget.abc = function(/* args from dojo/method */){
  // the body of dojo/method
};