From c208aed4096202bf71cdb6e0e39a02bc8e0d37fe Mon Sep 17 00:00:00 2001 From: Daniel Sellers Date: Fri, 25 Apr 2014 14:46:23 -0600 Subject: [PATCH] working on the framework --- public/javascripts/action.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/public/javascripts/action.js b/public/javascripts/action.js index 2720f4f..8b30d24 100644 --- a/public/javascripts/action.js +++ b/public/javascripts/action.js @@ -6,8 +6,12 @@ var action = function(){ var returnObject = objectIn , localEvents = {}; + //set an emitter id for troubleshooting returnObject.emitterId = Math.ceil(Math.random() * 10000); + //create the lcoal event Store + returnObject.eventStore = {}; + returnObject.emit = function(eventNameIn, eventDataIn, localFlag){ //add the emitterID to this thing var eventStack @@ -270,7 +274,7 @@ var action = function(){ }; //Event Based state machine - this.requiredEvent = function(name, callback, context, fireMultipleIn){ + returnObject.requiredEvent = function(name, callback, context, fireMultipleIn){ var stateUpdate; this._fireMultiple = (typeof fireMultipleIn !== 'undefined') ? fireMultipleIn : false; @@ -292,7 +296,7 @@ var action = function(){ this.event(name, callback, context); }; - this.stateUpdate = function(nameIn, stateEventsIn){ + returnObject.stateUpdate = function(nameIn, stateEventsIn){ var name = nameIn , stateEvents = stateEventsIn , that = this; @@ -326,8 +330,7 @@ var action = function(){ } }, returnObject); - returnObject.eventStore = {}; - + //execute the init function if it exists if(typeof returnObject.init === 'function'){ returnObject.init.apply(returnObject); }