Skip to content

Instantly share code, notes, and snippets.

@jcbozonier
Created January 2, 2012 01:18
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jcbozonier/1548890 to your computer and use it in GitHub Desktop.
Save jcbozonier/1548890 to your computer and use it in GitHub Desktop.
Javascript Event Store
var EventStore = function(){
var self = this;
var events = [];
var ignore_events = true;
self.on_hydration = function(event){};
self.store = function(event){
if(!ignore_events){
events.push(event);
}
};
self.hydrate = function(){
ignore_events = true;
events.map(function(event){
self.on_hydration(event);
});
ignore_events = false;
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment