Created
May 7, 2011 07:35
-
-
Save louisstow/960287 to your computer and use it in GitHub Desktop.
This file contains hidden or 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() { | |
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