Created
September 3, 2013 14:45
-
-
Save pjetr/6424911 to your computer and use it in GitHub Desktop.
enyo extending as suggested in the enyojs channel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enyo.kind({ | |
name: "pjetr.Object", | |
kind: enyo.Object, | |
bubble: function(inEventName, inEvent, inSender){ | |
console.log(arguments); | |
}, | |
create: function(){ | |
this.inherited(arguments); | |
enyo.mixin(this, new enyo.Component); | |
}, | |
}); | |
var obj = new pjetr.Object(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There must be another parameter set to
true
inmixin()
to not overwritte existing methods.The way I am proposing is more JavaScript specific than framework specific. In order to call function from super class you need to capture it on you closure before you overwritte it. In the closure of bubbleUp now is the super class call instead of the one that is exposed from the object. Notice the
this.bubbleUp.apply(this, arguments);
refers to the superclass