admin管理员组文章数量:1391951
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.)
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.)
Share Improve this question edited Aug 28, 2017 at 3:09 Cœur 38.8k25 gold badges205 silver badges277 bronze badges asked Oct 1, 2010 at 8:51 AriodAriod 5,85122 gold badges77 silver badges104 bronze badges 1- 1 Does this sitepen./blog/2007/09/21/… do anything for you? – mplungjan Commented Oct 1, 2010 at 9:18
2 Answers
Reset to default 8Just 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
};
Maybe the best option in your case is extend widget prototype, do it like that:
dojo.require("dijit.OneDijit");
dojo.extend(dijit.OneDijit, {
newMethod:function(/* method args */){
// body of method
}
});
本文标签: javascriptDojo39s dojomethod programmaticallyStack Overflow
版权声明:本文标题:javascript - Dojo's dojomethod programmatically? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744669159a2618717.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论