Link to http://robrobbins.info/?p=372 for an older version of dojo. In newer syntax, a class can be defined as follows to do the same:
define("Foo/FooMenuItem", ['dojo', 'dijit/dijit', "dojo/_base/declare", "dijit/MenuItem"], function(dojo, dijit, declare, MenuItem) { return declare("Foo.FooMenuItem", [MenuItem], { iconSrc: "unknown", _setIconSrcAttr: {node: "iconNode", type: "attribute", attribute: "src" } }); });
In the simple Foo.FooMenuItem class, the "icon" property can simply be set when the class is initialized and the set of values ββis inserted into the img src file registered for the icon. You can refer to it like this:
pMenu.addChild(new Foo.FooMenuItem ({ label: "clocks", iconSrc: "image/clocks.png", onClick: dojo.hitch(core.editor, core.editor.createNewApp) }));
source share