Open
Description
I'm doubt this is an issue, probably just a problem with what I'm doing but I can't get mixins to work using the default method.
MicroEvent.mixin = function(destObject){
var props = ['bind', 'unbind', 'trigger'];
for(var i = 0; i < props.length; i ++){
destObject.prototype[props[i]] = MicroEvent.prototype[props[i]];
}
}
When trying with an object
var obj = {
foo : 'bar',
method : function() { }
};
MicroEvent.mixin(obj);
I get can't convert undefined to object
. If I change the method to this though it works:
MicroEvent.mixin2 = function(destObject)
{
for (var k in MicroEvent.prototype)
{
if (MicroEvent.prototype.hasOwnProperty(k))
{
destObject[k] = MicroEvent.prototype[k];
}
}
}
Metadata
Metadata
Assignees
Labels
No labels