hippodrome 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 90d1d3261103fe6cf21ea04d9f8f400470adbcd5
4
- data.tar.gz: 903fe3308a249b12b6c32eeac90238d3ae72257e
3
+ metadata.gz: 3bb092221b5b0a477d3bedcdaf4fbc532ecc5c91
4
+ data.tar.gz: e6387d77205f198dca6de17cc44ec849fdf180c4
5
5
  SHA512:
6
- metadata.gz: 29ccb362c787847e02f4357a64ad3f27f9f207fc38c6a886d0b6257cbe973ff0d7fe13a893ef828e59cccf13497fed23822404697a1c0ef2879a707287f158c3
7
- data.tar.gz: 3a5fb979f6a3c8ebfa00f16a158137b4e47ea34c6ba07b6f16d02324bb86cc08fa2dde5a1881432e3f11bfeb057f3ff6253192007305ab9a0ccefba7842742a1
6
+ metadata.gz: 8811d6d654b9b49a2ad3d5ff346d2c27dfb9b72bac4e3859b405448d41edfc84091eebea41b6194af5d0cd82773a3643b316d69fb03ce73e3af75ee3de9a77f1
7
+ data.tar.gz: 01136d11b4d14c2b4a6d15be520b8d730041e904b83db20386a7c96325ff4cccd845885c0e059eee29841cfe7b683b99af619ffa69a6f471047e009c66820461
@@ -232,20 +232,29 @@
232
232
  _.assign(this._storeImpl, options["public"], bindToContextIfFunction(this._storeImpl));
233
233
  }
234
234
  this.displayName = options.displayName;
235
+ this.lastActionId = (function(_this) {
236
+ return function() {
237
+ return _this._storeImpl._lastActionId;
238
+ };
239
+ })(this);
235
240
  if (options.initialize) {
236
241
  options.initialize.call(this._storeImpl);
237
242
  }
238
243
  if (options.dispatches) {
239
244
  _.forEach(options.dispatches, (function(_this) {
240
245
  return function(dispatch) {
241
- var action, after, callback, id;
246
+ var action, after, callback, handleAction, id;
242
247
  action = dispatch.action, after = dispatch.after, callback = dispatch.callback;
243
248
  assert(!_this._storeImpl.dispatcherIdsByAction[action.id], "Store " + _this.displayName + " registered two callbacks for action " + action.displayName);
244
249
  if (typeof callback === 'string') {
245
250
  callback = _this._storeImpl[callback];
246
251
  }
247
252
  callback = callback.bind(_this._storeImpl);
248
- id = Hippodrome.Dispatcher.register(_this, action.id, after, callback);
253
+ handleAction = (function(payload) {
254
+ this._lastActionId = payload.action;
255
+ return callback(payload);
256
+ }).bind(_this._storeImpl);
257
+ id = Hippodrome.Dispatcher.register(_this, action.id, after, handleAction);
249
258
  return _this._storeImpl.dispatcherIdsByAction[action.id] = id;
250
259
  };
251
260
  })(this));
@@ -1,3 +1,3 @@
1
1
  //= require lodash
2
2
 
3
- (function(){var t,i,s,e,r,n,a,c,o,l,p,h,u,d=[].slice;p="undefined"==typeof window,u=p?require("lodash"):this._,e={},c=function(){var t,i,s,e,r;if(s=arguments[0],r=arguments[1],i=3<=arguments.length?d.call(arguments,2):[],!s)throw t=0,e=new Error("Assertion Failed: "+r.replace(/%s/g,function(){return i[t++]})),e.framesToPop=1,e;return s},r=function(t){return this._lastId=1,this._prefix=t},r.prototype.next=function(){return""+this._prefix+"_"+this._lastId++},a=new r("Action_ID"),t=function(t,i){var s,r,n,c;return n=""+a.next()+"_"+t,r=function(){var t;return t=i.apply(null,arguments),t.action=n,t},c=function(t){return e.Dispatcher.dispatch(t)},s=function(){var t;return t=r.apply(null,arguments),c(t)},s.buildPayload=r,s.send=c,s.displayName=t,s.id=n,s.toString=function(){return n},s},e.Action=t,s=function(){return this._callbacksByAction={},this._isStarted={},this._isFinished={},this._isDispatching=!1,this._payload=null},l=new r("Dispatcher_ID"),s.prototype.register=function(){var t,i,s,e,r,n,a;return i=u.compact(arguments),3===i.length?this.register(i[0],i[1],[],i[2]):(n=i[0],t=i[1],r=i[2],s=i[3],null==(a=this._callbacksByAction)[t]&&(a[t]={}),e=l.next(),this._callbacksByAction[t][e]={callback:s,prerequisites:u.map(r,function(i){return i._storeImpl.dispatcherIdsByAction[t]})},e)},s.prototype.unregister=function(t,i){return c(this._callbacksByAction[t][i],"Dispatcher.unregister(%s, %s) does not map to a registered callback.",t.displayName,i),this._callbacksByAction[t][i]=null},s.prototype.waitFor=function(t,i){return c(this._isDispatching,"Dispatcher.waitFor must be invoked while dispatching."),u.forEach(i,function(i){return function(s){return i._isStarted[s]?void c(i._isFinished[s],"Dispatcher.waitFor encountered circular dependency while waiting for `%s` during %s.",s,t.displayName):(c(i._callbacksByAction[t][s],"Dispatcher.waitFor `%s` is not a registered callback for %s.",s,t.displayName),i.invokeCallback(t,s))}}(this))},s.prototype.dispatch=function(t){var i;c(!this._isDispatching,"Dispatch.dispatch cannot be called during dispatch."),this.startDispatching(t);try{return i=t.action,u.forEach(this._callbacksByAction[i],function(t){return function(s,e){return t._isStarted[e]?void 0:t.invokeCallback(i,e)}}(this))}finally{this.stopDispatching()}},s.prototype.invokeCallback=function(t,i){var s,e,r;return this._isStarted[i]=!0,r=this._callbacksByAction[t][i],s=r.callback,e=r.prerequisites,this.waitFor(t,e),s(this._payload),this._isFinished[i]=!0},s.prototype.startDispatching=function(t){return this._isStarted={},this._isFinished={},this._payload=t,this._isDispatching=!0},s.prototype.stopDispatching=function(){return this._payload=null,this._isDispatching=!1},e.Dispatcher=new s,h=function(t,i){return"string"==typeof i&&(i=t[i]),function(){var s;return s=arguments,setTimeout(function(){return i.apply(t,s)},1)}},i=function(t){var i,s,r;return this.displayName=t.displayName,c(t.action||t.dispatches,"Deferred Task "+this.displayName+" must include either an action key or dispatches list."),c(!t.action||t.task,"Deferred Task "+this.displayName+" declared an action, it must declare a task."),u.assign(this,u.omit(t,"dispatches","action","task"),o(this)),this._dispatcherIdsByAction={},t.initialize&&t.initialize.call(this),t.action&&t.task&&(i=t.action,r=t.task,r=h(this,r),s=e.Dispatcher.register(this,i.id,[],r),this._dispatcherIdsByAction[i.id]=s),t.dispatches&&u.forEach(t.dispatches,function(t){return function(r){var n;return i=r.action,n=r.callback,c(!t._dispatcherIdsByAction[i.id],"Deferred Task "+t.displayName+" registered two callbacks for the action "+i.displayName+"."),n=h(t,n),s=e.Dispatcher.register(t,i.id,[],n),t._dispatcherIdsByAction[i.id]=s}}(this)),this},e.DeferredTask=i,o=function(t){return function(i,s){return s instanceof Function?s.bind(t):s}},n=function(t){return this._storeImpl={trigger:function(){return u.each(this.callbacks,function(t){return t()})}},this._storeImpl.dispatcherIdsByAction={},this._storeImpl.callbacks=[],u.assign(this._storeImpl,u.omit(t,"initialize","dispatches","public"),o(this._storeImpl)),t["public"]&&(u.assign(this,t["public"],o(this._storeImpl)),u.assign(this._storeImpl,t["public"],o(this._storeImpl))),this.displayName=t.displayName,t.initialize&&t.initialize.call(this._storeImpl),t.dispatches&&u.forEach(t.dispatches,function(t){return function(i){var s,r,n,a;return s=i.action,r=i.after,n=i.callback,c(!t._storeImpl.dispatcherIdsByAction[s.id],"Store "+t.displayName+" registered two callbacks for action "+s.displayName),"string"==typeof n&&(n=t._storeImpl[n]),n=n.bind(t._storeImpl),a=e.Dispatcher.register(t,s.id,r,n),t._storeImpl.dispatcherIdsByAction[s.id]=a}}(this)),this},n.prototype.register=function(t){return this._storeImpl.callbacks.push(t)},n.prototype.unregister=function(t){return this._storeImpl.callbacks=u.reject(this._storeImpl.callbacks,function(i){return i===t})},n.prototype.listen=function(t){var i;return i=this,{componentDidMount:function(){return i.register(this[t])},componentWillUnmount:function(){return i.unregister(this[t])}}},n.prototype.trigger=function(){return this._storeImpl.trigger()},e.Store=n,p?module.exports=e:this.Hippodrome=e}).call(this);
3
+ (function(){var t,i,s,n,e,r,a,c,o,l,p,u,h,d=[].slice;p="undefined"==typeof window,h=p?require("lodash"):this._,n={},c=function(){var t,i,s,n,e;if(s=arguments[0],e=arguments[1],i=3<=arguments.length?d.call(arguments,2):[],!s)throw t=0,n=new Error("Assertion Failed: "+e.replace(/%s/g,function(){return i[t++]})),n.framesToPop=1,n;return s},e=function(t){return this._lastId=1,this._prefix=t},e.prototype.next=function(){return""+this._prefix+"_"+this._lastId++},a=new e("Action_ID"),t=function(t,i){var s,e,r,c;return r=""+a.next()+"_"+t,e=function(){var t;return t=i.apply(null,arguments),t.action=r,t},c=function(t){return n.Dispatcher.dispatch(t)},s=function(){var t;return t=e.apply(null,arguments),c(t)},s.buildPayload=e,s.send=c,s.displayName=t,s.id=r,s.toString=function(){return r},s},n.Action=t,s=function(){return this._callbacksByAction={},this._isStarted={},this._isFinished={},this._isDispatching=!1,this._payload=null},l=new e("Dispatcher_ID"),s.prototype.register=function(){var t,i,s,n,e,r,a;return i=h.compact(arguments),3===i.length?this.register(i[0],i[1],[],i[2]):(r=i[0],t=i[1],e=i[2],s=i[3],null==(a=this._callbacksByAction)[t]&&(a[t]={}),n=l.next(),this._callbacksByAction[t][n]={callback:s,prerequisites:h.map(e,function(i){return i._storeImpl.dispatcherIdsByAction[t]})},n)},s.prototype.unregister=function(t,i){return c(this._callbacksByAction[t][i],"Dispatcher.unregister(%s, %s) does not map to a registered callback.",t.displayName,i),this._callbacksByAction[t][i]=null},s.prototype.waitFor=function(t,i){return c(this._isDispatching,"Dispatcher.waitFor must be invoked while dispatching."),h.forEach(i,function(i){return function(s){return i._isStarted[s]?void c(i._isFinished[s],"Dispatcher.waitFor encountered circular dependency while waiting for `%s` during %s.",s,t.displayName):(c(i._callbacksByAction[t][s],"Dispatcher.waitFor `%s` is not a registered callback for %s.",s,t.displayName),i.invokeCallback(t,s))}}(this))},s.prototype.dispatch=function(t){var i;c(!this._isDispatching,"Dispatch.dispatch cannot be called during dispatch."),this.startDispatching(t);try{return i=t.action,h.forEach(this._callbacksByAction[i],function(t){return function(s,n){return t._isStarted[n]?void 0:t.invokeCallback(i,n)}}(this))}finally{this.stopDispatching()}},s.prototype.invokeCallback=function(t,i){var s,n,e;return this._isStarted[i]=!0,e=this._callbacksByAction[t][i],s=e.callback,n=e.prerequisites,this.waitFor(t,n),s(this._payload),this._isFinished[i]=!0},s.prototype.startDispatching=function(t){return this._isStarted={},this._isFinished={},this._payload=t,this._isDispatching=!0},s.prototype.stopDispatching=function(){return this._payload=null,this._isDispatching=!1},n.Dispatcher=new s,u=function(t,i){return"string"==typeof i&&(i=t[i]),function(){var s;return s=arguments,setTimeout(function(){return i.apply(t,s)},1)}},i=function(t){var i,s,e;return this.displayName=t.displayName,c(t.action||t.dispatches,"Deferred Task "+this.displayName+" must include either an action key or dispatches list."),c(!t.action||t.task,"Deferred Task "+this.displayName+" declared an action, it must declare a task."),h.assign(this,h.omit(t,"dispatches","action","task"),o(this)),this._dispatcherIdsByAction={},t.initialize&&t.initialize.call(this),t.action&&t.task&&(i=t.action,e=t.task,e=u(this,e),s=n.Dispatcher.register(this,i.id,[],e),this._dispatcherIdsByAction[i.id]=s),t.dispatches&&h.forEach(t.dispatches,function(t){return function(e){var r;return i=e.action,r=e.callback,c(!t._dispatcherIdsByAction[i.id],"Deferred Task "+t.displayName+" registered two callbacks for the action "+i.displayName+"."),r=u(t,r),s=n.Dispatcher.register(t,i.id,[],r),t._dispatcherIdsByAction[i.id]=s}}(this)),this},n.DeferredTask=i,o=function(t){return function(i,s){return s instanceof Function?s.bind(t):s}},r=function(t){return this._storeImpl={trigger:function(){return h.each(this.callbacks,function(t){return t()})}},this._storeImpl.dispatcherIdsByAction={},this._storeImpl.callbacks=[],h.assign(this._storeImpl,h.omit(t,"initialize","dispatches","public"),o(this._storeImpl)),t["public"]&&(h.assign(this,t["public"],o(this._storeImpl)),h.assign(this._storeImpl,t["public"],o(this._storeImpl))),this.displayName=t.displayName,this.lastActionId=function(t){return function(){return t._storeImpl._lastActionId}}(this),t.initialize&&t.initialize.call(this._storeImpl),t.dispatches&&h.forEach(t.dispatches,function(t){return function(i){var s,e,r,a,o;return s=i.action,e=i.after,r=i.callback,c(!t._storeImpl.dispatcherIdsByAction[s.id],"Store "+t.displayName+" registered two callbacks for action "+s.displayName),"string"==typeof r&&(r=t._storeImpl[r]),r=r.bind(t._storeImpl),a=function(t){return this._lastActionId=t.action,r(t)}.bind(t._storeImpl),o=n.Dispatcher.register(t,s.id,e,a),t._storeImpl.dispatcherIdsByAction[s.id]=o}}(this)),this},r.prototype.register=function(t){return this._storeImpl.callbacks.push(t)},r.prototype.unregister=function(t){return this._storeImpl.callbacks=h.reject(this._storeImpl.callbacks,function(i){return i===t})},r.prototype.listen=function(t){var i;return i=this,{componentDidMount:function(){return i.register(this[t])},componentWillUnmount:function(){return i.unregister(this[t])}}},r.prototype.trigger=function(){return this._storeImpl.trigger()},n.Store=r,p?module.exports=n:this.Hippodrome=n}).call(this);
@@ -1,3 +1,3 @@
1
1
  module Hippodrome
2
- VERSION = '0.1.7'
2
+ VERSION = '0.1.8'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hippodrome
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Kermes
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-11-23 00:00:00.000000000 Z
12
+ date: 2014-12-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler