// util/model.js
define(['util/class'], function(classCtor) {
return classCtor.create({
set: function(key, value) {
// this doesn't work, because self is pointing to window
if (value instanceof self) {
// do Something
}
}
});
});
This should be the base class of all my entitys. Because my modules are written in RequireJS style, i’m able to use the following workaround:
if (value instanceof require('util/model'))
This works fine, but now my code is coupled to the ModuleName. Any suggestions how to avoid this coupling?
By the way: I use the prototype-based helper from Steffen Rusitschka to build my classes
You could just use a variable for your anonymous class: