Skip to content

Instantly share code, notes, and snippets.

@toddpi314
Created June 8, 2012 15:13
Show Gist options
  • Save toddpi314/2896094 to your computer and use it in GitHub Desktop.
Save toddpi314/2896094 to your computer and use it in GitHub Desktop.
Rich_Domain_Concepts
Namespace.Register("DeepElement.ThreeOneFour.Component")
/*
* Represents a Javascript Component Baseclass that supports async
* loading/unloading
*
*/
DeepElement.ThreeOneFour.Component = new Class({
Implements: Events,
loaded: false,
initialize: function() {},
load: function(success, failure) {
if (!this.loaded) {
this.loaded = true;
if (success != null) success();
}
},
unload: function(success, failure) {
if (this.loaded) {
this.loaded = false;
if (success != null) success();
}
},
getLoaded: function() {
return this.loaded;
}
});​
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment