Skip to content

Instantly share code, notes, and snippets.

@louisstow
Created May 7, 2011 07:35
Show Gist options
  • Save louisstow/960287 to your computer and use it in GitHub Desktop.
Save louisstow/960287 to your computer and use it in GitHub Desktop.
(function() {
var privateVar = 5;
Crafty.c('NewComponent', {
publicPropertyA: null,
publicPropertyB: 33,
init: function(){
this.require('ComponentA, ComponentB, ComponentC');
this.propertyA = new Object();
// DECLARATION OF PRIVATE PROPERTIES AND METHODS
var privatePropertyA = false;
var privateMethodA = function(){}
this.bind('eventNameDeclaredByComponentB', function(eventReturnData){
privateMethodA();
});
},
publicMethodA: function(){
return true && privatePropertyA; // <-- In this scope, is still valid?
},
publicMethodB: function(){
privateMethodA();
return '33';
}
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment