Created
April 23, 2009 04:21
-
-
Save anutron/100304 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
Class.events = new Events(); | |
Class.Mutators.initialize = function(initialize){ | |
return function(){ | |
Class.events.fireEvent('initialize', this); | |
var inited = initialize.apply(this, arguments); | |
Class.events.fireEvent('afterInitialize', this); | |
return inited; | |
} | |
}; | |
Class.events.addEvent('initialize', function(instance){ | |
$splat(instance.Binds).each(function(name){ | |
var original = instance[name]; | |
if (original) instance[name] = original.bind(instance); | |
}); | |
delete instance.Binds; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment