hippodrome 0.1.8 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/javascripts/hippodrome.js +210 -177
- data/app/assets/javascripts/hippodrome.min.js +1 -1
- data/lib/hippodrome/version.rb +1 -1
- metadata +2 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cea5a30796c2f07b1c942ab9bd1b42c711b1e416
|
4
|
+
data.tar.gz: 8d3ed9d54d4c10099538105eb9b47b2e472519f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3953db98cf94e79fcce5f6c781e01ae28e40f2eb2830705f59849fe06b19bb1793df1e00f15a9062e588f5c298e1f2f9590a8954fd5ba44a3837fadf864e9dc9
|
7
|
+
data.tar.gz: a5b7b1d345ada7db75e5751751931d83108518e8fea95b85f2ecc2e4f39bcca04e212b01ac8d6ea5845f4fc36ce0ced98e7e56b67b7f0ba16374e543e9a22891
|
@@ -1,7 +1,7 @@
|
|
1
1
|
//= require lodash
|
2
2
|
|
3
3
|
(function() {
|
4
|
-
var
|
4
|
+
var Hippodrome, IdFactory, actionIds, assert, bindToContextIfFunction, createAction, createDeferredTask, createDispatcher, createStore, dispatcherIds, isNode, makeDeferredFunction, makeToFn, _,
|
5
5
|
__slice = [].slice;
|
6
6
|
|
7
7
|
isNode = typeof window === 'undefined';
|
@@ -39,126 +39,117 @@
|
|
39
39
|
|
40
40
|
actionIds = new IdFactory('Action_ID');
|
41
41
|
|
42
|
-
|
43
|
-
var
|
44
|
-
|
42
|
+
createAction = function(options) {
|
43
|
+
var action, buildPayload, id;
|
44
|
+
assert(options.build instanceof Function, "Action " + options.displayName + " did not define a build function.");
|
45
|
+
id = "" + (actionIds.next()) + "_" + options.displayName;
|
45
46
|
buildPayload = function() {
|
46
47
|
var payload;
|
47
|
-
payload =
|
48
|
-
payload.
|
48
|
+
payload = options.build.apply(null, arguments);
|
49
|
+
payload._action = id;
|
49
50
|
return payload;
|
50
51
|
};
|
51
|
-
|
52
|
-
return Hippodrome.Dispatcher.dispatch(payload);
|
53
|
-
};
|
54
|
-
actionFn = function() {
|
52
|
+
action = function() {
|
55
53
|
var payload;
|
56
54
|
payload = buildPayload.apply(null, arguments);
|
57
|
-
return
|
55
|
+
return Hippodrome.Dispatcher.dispatch(payload);
|
58
56
|
};
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
actionFn.toString = function() {
|
57
|
+
action.buildPayload = buildPayload;
|
58
|
+
action.displayName = options.displayName;
|
59
|
+
action.id = id;
|
60
|
+
action.toString = function() {
|
64
61
|
return id;
|
65
62
|
};
|
66
|
-
return
|
63
|
+
return action;
|
67
64
|
};
|
68
65
|
|
69
|
-
Hippodrome.
|
70
|
-
|
71
|
-
Dispatcher = function() {
|
72
|
-
this._callbacksByAction = {};
|
73
|
-
this._isStarted = {};
|
74
|
-
this._isFinished = {};
|
75
|
-
this._isDispatching = false;
|
76
|
-
return this._payload = null;
|
77
|
-
};
|
66
|
+
Hippodrome.createAction = createAction;
|
78
67
|
|
79
68
|
dispatcherIds = new IdFactory('Dispatcher_ID');
|
80
69
|
|
81
|
-
|
82
|
-
var
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
70
|
+
createDispatcher = function() {
|
71
|
+
var dispatcher;
|
72
|
+
dispatcher = {
|
73
|
+
_callbacksByAction: {},
|
74
|
+
_isStarted: {},
|
75
|
+
_isFinished: {},
|
76
|
+
_isDispatching: false,
|
77
|
+
_payload: null
|
78
|
+
};
|
79
|
+
dispatcher.register = function(action, callback, prerequisites) {
|
80
|
+
var id, _base;
|
81
|
+
if (prerequisites == null) {
|
82
|
+
prerequisites = [];
|
83
|
+
}
|
88
84
|
if ((_base = this._callbacksByAction)[action] == null) {
|
89
85
|
_base[action] = {};
|
90
86
|
}
|
91
87
|
id = dispatcherIds.next();
|
92
88
|
this._callbacksByAction[action][id] = {
|
93
89
|
callback: callback,
|
94
|
-
prerequisites:
|
95
|
-
return ps._storeImpl.dispatcherIdsByAction[action];
|
96
|
-
})
|
90
|
+
prerequisites: prerequisites
|
97
91
|
};
|
98
92
|
return id;
|
99
|
-
}
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
return function(id) {
|
111
|
-
if (_this._isStarted[id]) {
|
112
|
-
assert(_this._isFinished[id], 'Dispatcher.waitFor encountered circular dependency while ' + 'waiting for `%s` during %s.', id, action.displayName);
|
113
|
-
return;
|
114
|
-
}
|
115
|
-
assert(_this._callbacksByAction[action][id], 'Dispatcher.waitFor `%s` is not a registered callback for %s.', id, action.displayName);
|
116
|
-
return _this.invokeCallback(action, id);
|
117
|
-
};
|
118
|
-
})(this));
|
119
|
-
};
|
120
|
-
|
121
|
-
Dispatcher.prototype.dispatch = function(payload) {
|
122
|
-
var action;
|
123
|
-
assert(!this._isDispatching, 'Dispatch.dispatch cannot be called during dispatch.');
|
124
|
-
this.startDispatching(payload);
|
125
|
-
try {
|
126
|
-
action = payload.action;
|
127
|
-
return _.forEach(this._callbacksByAction[action], (function(_this) {
|
128
|
-
return function(callback, id) {
|
93
|
+
};
|
94
|
+
dispatcher.unregister = function(action, id) {
|
95
|
+
assert(this._callbacksByAction && this._callbacksByAction[action][id], "Dispatcher.unregister(" + action.displayName + ", " + id + ") does not map to a registered callback.");
|
96
|
+
return delete this._callbacksByAction[action][id];
|
97
|
+
};
|
98
|
+
dispatcher.waitFor = function(action, stores) {
|
99
|
+
assert(this._isDispatching, "Dispatcher.waitFor must be called while dispatching.");
|
100
|
+
return _.forEach(stores, (function(_this) {
|
101
|
+
return function(store) {
|
102
|
+
var id;
|
103
|
+
id = store._storeImpl.dispatcherIdsByAction[action];
|
129
104
|
if (_this._isStarted[id]) {
|
105
|
+
assert(_this._isFinished[id], "Dispatcher.waitFor encountered circular dependency trying to wait for " + id + " during action " + action.displayName + ".");
|
130
106
|
return;
|
131
107
|
}
|
108
|
+
assert(_this._callbacksByAction[action][id], "Dispatcher.waitFor " + id + " is not a registered callback for " + action.displayName + ".");
|
132
109
|
return _this.invokeCallback(action, id);
|
133
110
|
};
|
134
111
|
})(this));
|
135
|
-
}
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
112
|
+
};
|
113
|
+
dispatcher.dispatch = function(payload) {
|
114
|
+
var action;
|
115
|
+
assert(!this._isDispatching, "Dispatcher.dispatch cannot be called during dispatch.");
|
116
|
+
this.startDispatching(payload);
|
117
|
+
try {
|
118
|
+
action = payload._action;
|
119
|
+
return _.forEach(this._callbacksByAction[action], (function(_this) {
|
120
|
+
return function(callback, id) {
|
121
|
+
if (_this._isStarted[id]) {
|
122
|
+
return;
|
123
|
+
}
|
124
|
+
return _this.invokeCallback(action, id);
|
125
|
+
};
|
126
|
+
})(this));
|
127
|
+
} finally {
|
128
|
+
this.stopDispatching();
|
129
|
+
}
|
130
|
+
};
|
131
|
+
dispatcher.invokeCallback = function(action, id) {
|
132
|
+
var callback, prerequisites, _ref;
|
133
|
+
this._isStarted[id] = true;
|
134
|
+
_ref = this._callbacksByAction[action][id], callback = _ref.callback, prerequisites = _ref.prerequisites;
|
135
|
+
this.waitFor(action, prerequisites);
|
136
|
+
callback(this._payload);
|
137
|
+
return this._isFinished[id] = true;
|
138
|
+
};
|
139
|
+
dispatcher.startDispatching = function(payload) {
|
140
|
+
this._isStarted = {};
|
141
|
+
this._isFinished = {};
|
142
|
+
this._payload = payload;
|
143
|
+
return this._isDispatching = true;
|
144
|
+
};
|
145
|
+
dispatcher.stopDispatching = function() {
|
146
|
+
this._payload = null;
|
147
|
+
return this._isDispatching = false;
|
148
|
+
};
|
149
|
+
return dispatcher;
|
159
150
|
};
|
160
151
|
|
161
|
-
Hippodrome.Dispatcher =
|
152
|
+
Hippodrome.Dispatcher = createDispatcher();
|
162
153
|
|
163
154
|
makeDeferredFunction = function(context, fn) {
|
164
155
|
if (typeof fn === 'string') {
|
@@ -173,38 +164,37 @@
|
|
173
164
|
};
|
174
165
|
};
|
175
166
|
|
176
|
-
|
177
|
-
var
|
178
|
-
|
179
|
-
assert(options.
|
180
|
-
|
181
|
-
_.assign(
|
182
|
-
|
167
|
+
createDeferredTask = function(options) {
|
168
|
+
var task;
|
169
|
+
assert(!options.action || options.task, "Deferred Task " + options.displayName + " declared an action, it must declare a task.");
|
170
|
+
assert(!options.task || options.action, "Deferred Task " + options.displayName + " declared a task, it must declare an action.");
|
171
|
+
task = {};
|
172
|
+
_.assign(task, _.omit(options, 'initialize', 'action', 'task'), bindToContextIfFunction(task));
|
173
|
+
task.dispatch = function(action) {
|
174
|
+
var to;
|
175
|
+
assert(task._dispatcherIdsByAction[action.id] === void 0, "Deferred Task " + task.displayName + " attempted to register twice for action " + action.displayName + ".");
|
176
|
+
to = function(callback) {
|
177
|
+
var id;
|
178
|
+
callback = makeDeferredFunction(task, callback);
|
179
|
+
id = Hippodrome.Dispatcher.register(action.id, callback);
|
180
|
+
task._dispatcherIdsByAction[action.id] = id;
|
181
|
+
return id;
|
182
|
+
};
|
183
|
+
return {
|
184
|
+
to: to
|
185
|
+
};
|
186
|
+
};
|
187
|
+
task._dispatcherIdsByAction = {};
|
183
188
|
if (options.initialize) {
|
184
|
-
options.initialize
|
189
|
+
task.dispatch(Hippodrome.start).to(options.initialize);
|
185
190
|
}
|
186
191
|
if (options.action && options.task) {
|
187
|
-
|
188
|
-
task = makeDeferredFunction(this, task);
|
189
|
-
id = Hippodrome.Dispatcher.register(this, action.id, [], task);
|
190
|
-
this._dispatcherIdsByAction[action.id] = id;
|
191
|
-
}
|
192
|
-
if (options.dispatches) {
|
193
|
-
_.forEach(options.dispatches, (function(_this) {
|
194
|
-
return function(dispatch) {
|
195
|
-
var callback;
|
196
|
-
action = dispatch.action, callback = dispatch.callback;
|
197
|
-
assert(!_this._dispatcherIdsByAction[action.id], "Deferred Task " + _this.displayName + " registered two callbacks for the action " + action.displayName + ".");
|
198
|
-
callback = makeDeferredFunction(_this, callback);
|
199
|
-
id = Hippodrome.Dispatcher.register(_this, action.id, [], callback);
|
200
|
-
return _this._dispatcherIdsByAction[action.id] = id;
|
201
|
-
};
|
202
|
-
})(this));
|
192
|
+
task.dispatch(options.action).to(options.task);
|
203
193
|
}
|
204
|
-
return
|
194
|
+
return task;
|
205
195
|
};
|
206
196
|
|
207
|
-
Hippodrome.
|
197
|
+
Hippodrome.createDeferredTask = createDeferredTask;
|
208
198
|
|
209
199
|
bindToContextIfFunction = function(context) {
|
210
200
|
return function(objValue, srcValue) {
|
@@ -216,80 +206,123 @@
|
|
216
206
|
};
|
217
207
|
};
|
218
208
|
|
219
|
-
|
220
|
-
|
209
|
+
makeToFn = function(context, action, prerequisites) {
|
210
|
+
if (prerequisites == null) {
|
211
|
+
prerequisites = [];
|
212
|
+
}
|
213
|
+
return function(callback) {
|
214
|
+
var id;
|
215
|
+
if (typeof callback === 'string') {
|
216
|
+
callback = context[callback];
|
217
|
+
}
|
218
|
+
callback = callback.bind(context);
|
219
|
+
id = Hippodrome.Dispatcher.register(action.id, callback, prerequisites);
|
220
|
+
return context.dispatcherIdsByAction[action] = id;
|
221
|
+
};
|
222
|
+
};
|
223
|
+
|
224
|
+
createStore = function(options) {
|
225
|
+
var store, storeImpl;
|
226
|
+
storeImpl = {
|
227
|
+
dispatcherIdsByAction: {},
|
228
|
+
callbacks: [],
|
221
229
|
trigger: function() {
|
222
230
|
return _.each(this.callbacks, function(callback) {
|
223
231
|
return callback();
|
224
232
|
});
|
233
|
+
},
|
234
|
+
dispatch: function(action) {
|
235
|
+
var after, context;
|
236
|
+
assert(this.dispatcherIdsByAction[action] === void 0, "Store " + this.displayName + " attempted to register twice for action " + action.displayName + ".");
|
237
|
+
context = this;
|
238
|
+
after = function() {
|
239
|
+
var prerequisites;
|
240
|
+
prerequisites = arguments;
|
241
|
+
return {
|
242
|
+
to: makeToFn(context, action, prerequisites)
|
243
|
+
};
|
244
|
+
};
|
245
|
+
return {
|
246
|
+
after: after,
|
247
|
+
to: makeToFn(context, action)
|
248
|
+
};
|
225
249
|
}
|
226
250
|
};
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
+
store = {
|
252
|
+
_storeImpl: storeImpl,
|
253
|
+
displayName: options.displayName,
|
254
|
+
register: function(callback) {
|
255
|
+
return this._storeImpl.callbacks.push(callback);
|
256
|
+
},
|
257
|
+
unregister: function(callback) {
|
258
|
+
return _.remove(this._storeImpl.callbacks, function(cb) {
|
259
|
+
return cb === callback;
|
260
|
+
});
|
261
|
+
},
|
262
|
+
listen: function(property, fn) {
|
263
|
+
var callback, getState;
|
264
|
+
store = this;
|
265
|
+
getState = function() {
|
266
|
+
var state;
|
267
|
+
state = {};
|
268
|
+
state[property] = fn();
|
269
|
+
return state;
|
270
|
+
};
|
271
|
+
callback = function() {
|
272
|
+
return this.setState(getState());
|
273
|
+
};
|
274
|
+
return {
|
275
|
+
getInitialState: function() {
|
276
|
+
return getState();
|
277
|
+
},
|
278
|
+
componentDidMount: function() {
|
279
|
+
callback = callback.bind(this);
|
280
|
+
return store.register(callback);
|
281
|
+
},
|
282
|
+
componentWillUnmount: function() {
|
283
|
+
return store.unregister(callback);
|
251
284
|
}
|
252
|
-
callback = callback.bind(_this._storeImpl);
|
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);
|
258
|
-
return _this._storeImpl.dispatcherIdsByAction[action.id] = id;
|
259
285
|
};
|
260
|
-
})(this));
|
261
|
-
}
|
262
|
-
return this;
|
263
|
-
};
|
264
|
-
|
265
|
-
Store.prototype.register = function(callback) {
|
266
|
-
return this._storeImpl.callbacks.push(callback);
|
267
|
-
};
|
268
|
-
|
269
|
-
Store.prototype.unregister = function(callback) {
|
270
|
-
return this._storeImpl.callbacks = _.reject(this._storeImpl.callbacks, function(cb) {
|
271
|
-
return cb === callback;
|
272
|
-
});
|
273
|
-
};
|
274
|
-
|
275
|
-
Store.prototype.listen = function(callbackName) {
|
276
|
-
var store;
|
277
|
-
store = this;
|
278
|
-
return {
|
279
|
-
componentDidMount: function() {
|
280
|
-
return store.register(this[callbackName]);
|
281
286
|
},
|
282
|
-
|
283
|
-
|
287
|
+
listenWith: function(stateFnName) {
|
288
|
+
var callback;
|
289
|
+
store = this;
|
290
|
+
callback = function() {
|
291
|
+
return this.setState(this[stateFnName]());
|
292
|
+
};
|
293
|
+
return {
|
294
|
+
getInitialState: function() {
|
295
|
+
return this[stateFnName]();
|
296
|
+
},
|
297
|
+
componentDidMount: function() {
|
298
|
+
callback = callback.bind(this);
|
299
|
+
return store.register(callback);
|
300
|
+
},
|
301
|
+
componentWillUnmount: function() {
|
302
|
+
return store.unregister(callback);
|
303
|
+
}
|
304
|
+
};
|
284
305
|
}
|
285
306
|
};
|
307
|
+
_.assign(storeImpl, _.omit(options, 'initialize', 'public'), bindToContextIfFunction(storeImpl));
|
308
|
+
if (options["public"]) {
|
309
|
+
_.assign(store, options["public"], bindToContextIfFunction(storeImpl));
|
310
|
+
_.assign(storeImpl, options["public"], bindToContextIfFunction(storeImpl));
|
311
|
+
}
|
312
|
+
if (options.initialize) {
|
313
|
+
storeImpl.dispatch(Hippodrome.start).to(options.initialize);
|
314
|
+
}
|
315
|
+
return store;
|
286
316
|
};
|
287
317
|
|
288
|
-
|
289
|
-
return this._storeImpl.trigger();
|
290
|
-
};
|
318
|
+
Hippodrome.createStore = createStore;
|
291
319
|
|
292
|
-
Hippodrome.
|
320
|
+
Hippodrome.start = new Hippodrome.createAction({
|
321
|
+
displayName: 'start Hippodrome',
|
322
|
+
build: function(options) {
|
323
|
+
return options || {};
|
324
|
+
}
|
325
|
+
});
|
293
326
|
|
294
327
|
if (isNode) {
|
295
328
|
module.exports = Hippodrome;
|
@@ -1,3 +1,3 @@
|
|
1
1
|
//= require lodash
|
2
2
|
|
3
|
-
(function(){var t,i,
|
3
|
+
(function(){var t,i,n,e,r,a,s,c,o,u,l,d,p,h,f=[].slice;l="undefined"==typeof window,h=l?require("lodash"):this._,t={},e=function(){var t,i,n,e,r;if(n=arguments[0],r=arguments[1],i=3<=arguments.length?f.call(arguments,2):[],!n)throw t=0,e=new Error("Assertion Failed: "+r.replace(/%s/g,function(){return i[t++]})),e.framesToPop=1,e;return n},i=function(t){return this._lastId=1,this._prefix=t},i.prototype.next=function(){return""+this._prefix+"_"+this._lastId++},n=new i("Action_ID"),a=function(i){var r,a,s;return e(i.build instanceof Function,"Action "+i.displayName+" did not define a build function."),s=""+n.next()+"_"+i.displayName,a=function(){var t;return t=i.build.apply(null,arguments),t._action=s,t},r=function(){var i;return i=a.apply(null,arguments),t.Dispatcher.dispatch(i)},r.buildPayload=a,r.displayName=i.displayName,r.id=s,r.toString=function(){return s},r},t.createAction=a,u=new i("Dispatcher_ID"),c=function(){var t;return t={_callbacksByAction:{},_isStarted:{},_isFinished:{},_isDispatching:!1,_payload:null},t.register=function(t,i,n){var e,r;return null==n&&(n=[]),null==(r=this._callbacksByAction)[t]&&(r[t]={}),e=u.next(),this._callbacksByAction[t][e]={callback:i,prerequisites:n},e},t.unregister=function(t,i){return e(this._callbacksByAction&&this._callbacksByAction[t][i],"Dispatcher.unregister("+t.displayName+", "+i+") does not map to a registered callback."),delete this._callbacksByAction[t][i]},t.waitFor=function(t,i){return e(this._isDispatching,"Dispatcher.waitFor must be called while dispatching."),h.forEach(i,function(i){return function(n){var r;return r=n._storeImpl.dispatcherIdsByAction[t],i._isStarted[r]?void e(i._isFinished[r],"Dispatcher.waitFor encountered circular dependency trying to wait for "+r+" during action "+t.displayName+"."):(e(i._callbacksByAction[t][r],"Dispatcher.waitFor "+r+" is not a registered callback for "+t.displayName+"."),i.invokeCallback(t,r))}}(this))},t.dispatch=function(t){var i;e(!this._isDispatching,"Dispatcher.dispatch cannot be called during dispatch."),this.startDispatching(t);try{return i=t._action,h.forEach(this._callbacksByAction[i],function(t){return function(n,e){return t._isStarted[e]?void 0:t.invokeCallback(i,e)}}(this))}finally{this.stopDispatching()}},t.invokeCallback=function(t,i){var n,e,r;return this._isStarted[i]=!0,r=this._callbacksByAction[t][i],n=r.callback,e=r.prerequisites,this.waitFor(t,e),n(this._payload),this._isFinished[i]=!0},t.startDispatching=function(t){return this._isStarted={},this._isFinished={},this._payload=t,this._isDispatching=!0},t.stopDispatching=function(){return this._payload=null,this._isDispatching=!1},t},t.Dispatcher=c(),d=function(t,i){return"string"==typeof i&&(i=t[i]),function(){var n;return n=arguments,setTimeout(function(){return i.apply(t,n)},1)}},s=function(i){var n;return e(!i.action||i.task,"Deferred Task "+i.displayName+" declared an action, it must declare a task."),e(!i.task||i.action,"Deferred Task "+i.displayName+" declared a task, it must declare an action."),n={},h.assign(n,h.omit(i,"initialize","action","task"),r(n)),n.dispatch=function(i){var r;return e(void 0===n._dispatcherIdsByAction[i.id],"Deferred Task "+n.displayName+" attempted to register twice for action "+i.displayName+"."),r=function(e){var r;return e=d(n,e),r=t.Dispatcher.register(i.id,e),n._dispatcherIdsByAction[i.id]=r,r},{to:r}},n._dispatcherIdsByAction={},i.initialize&&n.dispatch(t.start).to(i.initialize),i.action&&i.task&&n.dispatch(i.action).to(i.task),n},t.createDeferredTask=s,r=function(t){return function(i,n){return n instanceof Function?n.bind(t):n}},p=function(i,n,e){return null==e&&(e=[]),function(r){var a;return"string"==typeof r&&(r=i[r]),r=r.bind(i),a=t.Dispatcher.register(n.id,r,e),i.dispatcherIdsByAction[n]=a}},o=function(i){var n,a;return a={dispatcherIdsByAction:{},callbacks:[],trigger:function(){return h.each(this.callbacks,function(t){return t()})},dispatch:function(t){var i,n;return e(void 0===this.dispatcherIdsByAction[t],"Store "+this.displayName+" attempted to register twice for action "+t.displayName+"."),n=this,i=function(){var i;return i=arguments,{to:p(n,t,i)}},{after:i,to:p(n,t)}}},n={_storeImpl:a,displayName:i.displayName,register:function(t){return this._storeImpl.callbacks.push(t)},unregister:function(t){return h.remove(this._storeImpl.callbacks,function(i){return i===t})},listen:function(t,i){var e,r;return n=this,r=function(){var n;return n={},n[t]=i(),n},e=function(){return this.setState(r())},{getInitialState:function(){return r()},componentDidMount:function(){return e=e.bind(this),n.register(e)},componentWillUnmount:function(){return n.unregister(e)}}},listenWith:function(t){var i;return n=this,i=function(){return this.setState(this[t]())},{getInitialState:function(){return this[t]()},componentDidMount:function(){return i=i.bind(this),n.register(i)},componentWillUnmount:function(){return n.unregister(i)}}}},h.assign(a,h.omit(i,"initialize","public"),r(a)),i["public"]&&(h.assign(n,i["public"],r(a)),h.assign(a,i["public"],r(a))),i.initialize&&a.dispatch(t.start).to(i.initialize),n},t.createStore=o,t.start=new t.createAction({displayName:"start Hippodrome",build:function(t){return t||{}}}),l?module.exports=t:this.Hippodrome=t}).call(this);
|
data/lib/hippodrome/version.rb
CHANGED
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.
|
4
|
+
version: 0.2.0
|
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:
|
12
|
+
date: 2015-01-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -110,4 +110,3 @@ specification_version: 4
|
|
110
110
|
summary: Your data, like your chariots, go around and around in one direction in this,
|
111
111
|
a Flux implementation that only Ben Hur could love.
|
112
112
|
test_files: []
|
113
|
-
has_rdoc:
|