I am trying to define a class, but when I reference it in my code I get an error
Error: declare custom.place: mixin #0 is not a callable constructor
define(['dojo', 'dijit/dijit', "dojo/_base/declare", "dijit/place"],
function(dojo, dijit, declare, place) {
return declare("custom.place", [place], {
newMethod: function() { }
});
})
This will not work. But the following code, works fine!
define(['dojo', 'dijit/dijit', "dojo/_base/declare", "dijit/MenuItem"],
function(dojo, dijit, declare, MenuItem) {
return declare("custom.item", [MenuItem], {
newMethod: function() { }
});
})
Any help is appreciated. Thanks.
Dojo classes can only extend other Dojo classes.
dojo/placeis not a Dojo class; it is merely an object with some function properties.The above code gives the console output:
If you want an object with place’s utility functions and some extra ones, you could create your own version like this:
If you wanted to mixin place’s functionality to a Dojo class you could do it using safeMixin but I’m not sure why you would want to.