Created
August 26, 2014 01:05
-
-
Save Volune/b843f6966a5ba224ed74 to your computer and use it in GitHub Desktop.
Suggestions for http://stackoverflow.com/questions/25495044/private-functions-similar-to-java-using-literals
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
function createBackground() { | |
} | |
var StartScreenLayer = cc.Layer.extend({ | |
ctor: function () { | |
this._super(); | |
// this function can call createBackground! | |
createBackground.call(this); | |
}, | |
callCreateBackgroundToo: function () { | |
// I can call createBackground too! | |
createBackground.call(this); | |
} | |
}); |
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
var StartScreenLayer = cc.Layer.extend((function(){ | |
function createBackground() { | |
} | |
return { | |
ctor: function () { | |
this._super(); | |
// this function can call createBackground! | |
createBackground.call(this); | |
}, | |
callCreateBackgroundToo: function () { | |
// I can call createBackground too! | |
createBackground.call(this); | |
} | |
}; | |
})()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment