Created
January 9, 2015 01:28
-
-
Save AGoblinKing/196442c60fdc9698aa79 to your computer and use it in GitHub Desktop.
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
Component = { | |
entitiesAttached : [], | |
call : function(message) { | |
// first give the component a shot | |
if(typeof this[message.n] === "function") { | |
this[message.n](message); | |
} | |
// then its attached versions | |
if(typeof this.e[message.n] === "function") { | |
this.entitiesAttached.forEach(function(e) { | |
e.call(message); | |
}); | |
} | |
} | |
}; | |
World = { | |
broadcast : function(message) { | |
Object.keys(Vx.components).forEach(function(name) { | |
var c = Vx.components[name]; | |
c.call(message); | |
}); | |
} | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment