-
-
Save clinuz/ed0ca11492b6f65fca6e to your computer and use it in GitHub Desktop.
Example of how to avoid sharing array/object references between kinds in Enyo (or JavaScript).
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: "sample.Control", | |
// some property that is an array that gets modified per-instance | |
// means we can't supply one to be shared for all instances | |
// so we assign it to null | |
myArrayProp: null, | |
constructor: function () { | |
// here we can use 'this' for our instance and assign a new array | |
// that will not be shared with other instances of our kind | |
this.myArrayProp = []; | |
return this.inherited(arguments); | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment