reflux-rails 0.1.15

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: acc3c6e3b1fbc5d0551a060c85e722cde5bcf946
4
+ data.tar.gz: 4fd46fe6d97292e14b716c214fd05750ada7c78d
5
+ SHA512:
6
+ metadata.gz: c657503581c01d6accd1aaa05e49e4a05d7fef0aead83e72b94737857536b0bb1b9776af70fadebc2672b97954aaafbdcb74fb94182157bf12bd5372e97ebc3b
7
+ data.tar.gz: 12e964a167e4ecb7193c34c55d2de345d9d2fbbb17166397f9396385d0b3673a55688aa6fde3ed7a35d5ceee40dcafb6d0b342bf92a47b35743d1fcf52a0e503
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in reflux-rails.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Wontae Yang
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,63 @@
1
+ # Reflux::Rails
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'reflux-rails'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install reflux-rails
20
+
21
+ ## Usage
22
+
23
+ This gem depends on browserify to load the javascript file
24
+ add browserify gem in your Gemfile
25
+
26
+ ```ruby
27
+ gem "browserify-rails"
28
+ ```
29
+
30
+ Create package.json in your Rails root:
31
+
32
+ ```javascipt
33
+ {
34
+ "name": "something",
35
+ "devDependencies" : {
36
+ "browserify": "~> 4.1"
37
+ },
38
+ "license": "MIT",
39
+ "engines": {
40
+ "node": ">= 0.10"
41
+ }
42
+ }
43
+ ```
44
+
45
+ Then run:
46
+
47
+ ```
48
+ npm install
49
+ ```
50
+
51
+ Include reflux in your app/assets/javascripts/application.js
52
+
53
+ ```javascript
54
+ var Reflux = require('./reflux');
55
+ ```
56
+
57
+ ## Contributing
58
+
59
+ 1. Fork it ( https://github.com/[my-github-username]/reflux-rails/fork )
60
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
61
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
62
+ 4. Push to the branch (`git push origin my-new-feature`)
63
+ 5. Create a new Pull Request
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,11 @@
1
+ require "reflux/rails/version"
2
+
3
+ module Reflux
4
+ module Rails
5
+ if ::Rails.version < "3.1"
6
+ require "reflux/railtie"
7
+ else
8
+ require "reflux/engine"
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,6 @@
1
+ module Reflux
2
+ module Rails
3
+ class Engine < ::Rails::Engine
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module Reflux
2
+ module Rails
3
+ class Railtie < ::Rails::Railtie
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ module Reflux
2
+ module Rails
3
+ VERSION = "0.1.15"
4
+ end
5
+ end
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'reflux/rails/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "reflux-rails"
8
+ spec.version = Reflux::Rails::VERSION
9
+ spec.authors = ["Wontae Yang"]
10
+ spec.email = ["wontaeyang@gmail.com"]
11
+ spec.summary = "refluxjs gem for rails"
12
+ spec.description = "this is a Ruby gem for building reflux application"
13
+ spec.homepage = "https://github.com/wontaeyang/reflux-rails"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ # spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ # spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.7"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ end
@@ -0,0 +1,876 @@
1
+ !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.Reflux=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
2
+ 'use strict';
3
+
4
+ /**
5
+ * Representation of a single EventEmitter function.
6
+ *
7
+ * @param {Function} fn Event handler to be called.
8
+ * @param {Mixed} context Context for function execution.
9
+ * @param {Boolean} once Only emit once
10
+ * @api private
11
+ */
12
+ function EE(fn, context, once) {
13
+ this.fn = fn;
14
+ this.context = context;
15
+ this.once = once || false;
16
+ }
17
+
18
+ /**
19
+ * Minimal EventEmitter interface that is molded against the Node.js
20
+ * EventEmitter interface.
21
+ *
22
+ * @constructor
23
+ * @api public
24
+ */
25
+ function EventEmitter() { /* Nothing to set */ }
26
+
27
+ /**
28
+ * Holds the assigned EventEmitters by name.
29
+ *
30
+ * @type {Object}
31
+ * @private
32
+ */
33
+ EventEmitter.prototype._events = undefined;
34
+
35
+ /**
36
+ * Return a list of assigned event listeners.
37
+ *
38
+ * @param {String} event The events that should be listed.
39
+ * @returns {Array}
40
+ * @api public
41
+ */
42
+ EventEmitter.prototype.listeners = function listeners(event) {
43
+ if (!this._events || !this._events[event]) return [];
44
+
45
+ for (var i = 0, l = this._events[event].length, ee = []; i < l; i++) {
46
+ ee.push(this._events[event][i].fn);
47
+ }
48
+
49
+ return ee;
50
+ };
51
+
52
+ /**
53
+ * Emit an event to all registered event listeners.
54
+ *
55
+ * @param {String} event The name of the event.
56
+ * @returns {Boolean} Indication if we've emitted an event.
57
+ * @api public
58
+ */
59
+ EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
60
+ if (!this._events || !this._events[event]) return false;
61
+
62
+ var listeners = this._events[event]
63
+ , length = listeners.length
64
+ , len = arguments.length
65
+ , ee = listeners[0]
66
+ , args
67
+ , i, j;
68
+
69
+ if (1 === length) {
70
+ if (ee.once) this.removeListener(event, ee.fn, true);
71
+
72
+ switch (len) {
73
+ case 1: return ee.fn.call(ee.context), true;
74
+ case 2: return ee.fn.call(ee.context, a1), true;
75
+ case 3: return ee.fn.call(ee.context, a1, a2), true;
76
+ case 4: return ee.fn.call(ee.context, a1, a2, a3), true;
77
+ case 5: return ee.fn.call(ee.context, a1, a2, a3, a4), true;
78
+ case 6: return ee.fn.call(ee.context, a1, a2, a3, a4, a5), true;
79
+ }
80
+
81
+ for (i = 1, args = new Array(len -1); i < len; i++) {
82
+ args[i - 1] = arguments[i];
83
+ }
84
+
85
+ ee.fn.apply(ee.context, args);
86
+ } else {
87
+ for (i = 0; i < length; i++) {
88
+ if (listeners[i].once) this.removeListener(event, listeners[i].fn, true);
89
+
90
+ switch (len) {
91
+ case 1: listeners[i].fn.call(listeners[i].context); break;
92
+ case 2: listeners[i].fn.call(listeners[i].context, a1); break;
93
+ case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;
94
+ default:
95
+ if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {
96
+ args[j - 1] = arguments[j];
97
+ }
98
+
99
+ listeners[i].fn.apply(listeners[i].context, args);
100
+ }
101
+ }
102
+ }
103
+
104
+ return true;
105
+ };
106
+
107
+ /**
108
+ * Register a new EventListener for the given event.
109
+ *
110
+ * @param {String} event Name of the event.
111
+ * @param {Functon} fn Callback function.
112
+ * @param {Mixed} context The context of the function.
113
+ * @api public
114
+ */
115
+ EventEmitter.prototype.on = function on(event, fn, context) {
116
+ if (!this._events) this._events = {};
117
+ if (!this._events[event]) this._events[event] = [];
118
+ this._events[event].push(new EE( fn, context || this ));
119
+
120
+ return this;
121
+ };
122
+
123
+ /**
124
+ * Add an EventListener that's only called once.
125
+ *
126
+ * @param {String} event Name of the event.
127
+ * @param {Function} fn Callback function.
128
+ * @param {Mixed} context The context of the function.
129
+ * @api public
130
+ */
131
+ EventEmitter.prototype.once = function once(event, fn, context) {
132
+ if (!this._events) this._events = {};
133
+ if (!this._events[event]) this._events[event] = [];
134
+ this._events[event].push(new EE(fn, context || this, true ));
135
+
136
+ return this;
137
+ };
138
+
139
+ /**
140
+ * Remove event listeners.
141
+ *
142
+ * @param {String} event The event we want to remove.
143
+ * @param {Function} fn The listener that we need to find.
144
+ * @param {Boolean} once Only remove once listeners.
145
+ * @api public
146
+ */
147
+ EventEmitter.prototype.removeListener = function removeListener(event, fn, once) {
148
+ if (!this._events || !this._events[event]) return this;
149
+
150
+ var listeners = this._events[event]
151
+ , events = [];
152
+
153
+ if (fn) for (var i = 0, length = listeners.length; i < length; i++) {
154
+ if (listeners[i].fn !== fn && listeners[i].once !== once) {
155
+ events.push(listeners[i]);
156
+ }
157
+ }
158
+
159
+ //
160
+ // Reset the array, or remove it completely if we have no more listeners.
161
+ //
162
+ if (events.length) this._events[event] = events;
163
+ else this._events[event] = null;
164
+
165
+ return this;
166
+ };
167
+
168
+ /**
169
+ * Remove all listeners or only the listeners for the specified event.
170
+ *
171
+ * @param {String} event The event want to remove all listeners for.
172
+ * @api public
173
+ */
174
+ EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {
175
+ if (!this._events) return this;
176
+
177
+ if (event) this._events[event] = null;
178
+ else this._events = {};
179
+
180
+ return this;
181
+ };
182
+
183
+ //
184
+ // Alias methods names because people roll like that.
185
+ //
186
+ EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
187
+ EventEmitter.prototype.addListener = EventEmitter.prototype.on;
188
+
189
+ //
190
+ // This function doesn't apply anymore.
191
+ //
192
+ EventEmitter.prototype.setMaxListeners = function setMaxListeners() {
193
+ return this;
194
+ };
195
+
196
+ //
197
+ // Expose the module.
198
+ //
199
+ EventEmitter.EventEmitter = EventEmitter;
200
+ EventEmitter.EventEmitter2 = EventEmitter;
201
+ EventEmitter.EventEmitter3 = EventEmitter;
202
+
203
+ if ('object' === typeof module && module.exports) {
204
+ module.exports = EventEmitter;
205
+ }
206
+
207
+ },{}],2:[function(_dereq_,module,exports){
208
+ exports.createdStores = [];
209
+
210
+ exports.createdActions = [];
211
+
212
+ exports.reset = function() {
213
+ while(exports.createdStores.length) {
214
+ exports.createdStores.pop();
215
+ }
216
+ while(exports.createdActions.length) {
217
+ exports.createdActions.pop();
218
+ }
219
+ };
220
+
221
+ },{}],3:[function(_dereq_,module,exports){
222
+ var _ = _dereq_('./utils'),
223
+ maker = _dereq_('./joins').instanceJoinCreator;
224
+
225
+ /**
226
+ * A module of methods related to listening.
227
+ */
228
+ module.exports = {
229
+
230
+ /**
231
+ * An internal utility function used by `validateListening`
232
+ *
233
+ * @param {Action|Store} listenable The listenable we want to search for
234
+ * @returns {Boolean} The result of a recursive search among `this.subscriptions`
235
+ */
236
+ hasListener: function(listenable) {
237
+ var i = 0,
238
+ listener;
239
+ for (;i < (this.subscriptions||[]).length; ++i) {
240
+ listener = this.subscriptions[i].listenable;
241
+ if (listener === listenable || listener.hasListener && listener.hasListener(listenable)) {
242
+ return true;
243
+ }
244
+ }
245
+ return false;
246
+ },
247
+
248
+ /**
249
+ * A convenience method that listens to all listenables in the given object.
250
+ *
251
+ * @param {Object} listenables An object of listenables. Keys will be used as callback method names.
252
+ */
253
+ listenToMany: function(listenables){
254
+ for(var key in listenables){
255
+ var cbname = _.callbackName(key),
256
+ localname = this[cbname] ? cbname : this[key] ? key : undefined;
257
+ if (localname){
258
+ this.listenTo(listenables[key],localname,this[cbname+"Default"]||this[localname+"Default"]||localname);
259
+ }
260
+ }
261
+ },
262
+
263
+ /**
264
+ * Checks if the current context can listen to the supplied listenable
265
+ *
266
+ * @param {Action|Store} listenable An Action or Store that should be
267
+ * listened to.
268
+ * @returns {String|Undefined} An error message, or undefined if there was no problem.
269
+ */
270
+ validateListening: function(listenable){
271
+ if (listenable === this) {
272
+ return "Listener is not able to listen to itself";
273
+ }
274
+ if (!_.isFunction(listenable.listen)) {
275
+ return listenable + " is missing a listen method";
276
+ }
277
+ if (listenable.hasListener && listenable.hasListener(this)) {
278
+ return "Listener cannot listen to this listenable because of circular loop";
279
+ }
280
+ },
281
+
282
+ /**
283
+ * Sets up a subscription to the given listenable for the context object
284
+ *
285
+ * @param {Action|Store} listenable An Action or Store that should be
286
+ * listened to.
287
+ * @param {Function|String} callback The callback to register as event handler
288
+ * @param {Function|String} defaultCallback The callback to register as default handler
289
+ * @returns {Object} A subscription obj where `stop` is an unsub function and `listenable` is the object being listened to
290
+ */
291
+ listenTo: function(listenable, callback, defaultCallback) {
292
+ var desub, unsubscriber, subscriptionobj, subs = this.subscriptions = this.subscriptions || [];
293
+ _.throwIf(this.validateListening(listenable));
294
+ this.fetchDefaultData(listenable, defaultCallback);
295
+ desub = listenable.listen(this[callback]||callback, this);
296
+ unsubscriber = function() {
297
+ var index = subs.indexOf(subscriptionobj);
298
+ _.throwIf(index === -1,'Tried to remove listen already gone from subscriptions list!');
299
+ subs.splice(index, 1);
300
+ desub();
301
+ };
302
+ subscriptionobj = {
303
+ stop: unsubscriber,
304
+ listenable: listenable
305
+ };
306
+ subs.push(subscriptionobj);
307
+ return subscriptionobj;
308
+ },
309
+
310
+ /**
311
+ * Stops listening to a single listenable
312
+ *
313
+ * @param {Action|Store} listenable The action or store we no longer want to listen to
314
+ * @returns {Boolean} True if a subscription was found and removed, otherwise false.
315
+ */
316
+ stopListeningTo: function(listenable){
317
+ var sub, i = 0, subs = this.subscriptions || [];
318
+ for(;i < subs.length; i++){
319
+ sub = subs[i];
320
+ if (sub.listenable === listenable){
321
+ sub.stop();
322
+ _.throwIf(subs.indexOf(sub)!==-1,'Failed to remove listen from subscriptions list!');
323
+ return true;
324
+ }
325
+ }
326
+ return false;
327
+ },
328
+
329
+ /**
330
+ * Stops all subscriptions and empties subscriptions array
331
+ */
332
+ stopListeningToAll: function(){
333
+ var remaining, subs = this.subscriptions || [];
334
+ while((remaining=subs.length)){
335
+ subs[0].stop();
336
+ _.throwIf(subs.length!==remaining-1,'Failed to remove listen from subscriptions list!');
337
+ }
338
+ },
339
+
340
+ /**
341
+ * Used in `listenTo`. Fetches initial data from a publisher if it has a `getDefaultData` method.
342
+ * @param {Action|Store} listenable The publisher we want to get default data from
343
+ * @param {Function|String} defaultCallback The method to receive the data
344
+ */
345
+ fetchDefaultData: function (listenable, defaultCallback) {
346
+ defaultCallback = (defaultCallback && this[defaultCallback]) || defaultCallback;
347
+ var me = this;
348
+ if (_.isFunction(defaultCallback) && _.isFunction(listenable.getDefaultData)) {
349
+ data = listenable.getDefaultData();
350
+ if (data && _.isFunction(data.then)) {
351
+ data.then(function() {
352
+ defaultCallback.apply(me, arguments);
353
+ });
354
+ } else {
355
+ defaultCallback.call(this, data);
356
+ }
357
+ }
358
+ },
359
+
360
+ /**
361
+ * The callback will be called once all listenables have triggered at least once.
362
+ * It will be invoked with the last emission from each listenable.
363
+ * @param {...Publishers} publishers Publishers that should be tracked.
364
+ * @param {Function|String} callback The method to call when all publishers have emitted
365
+ */
366
+ joinTrailing: maker("last"),
367
+
368
+ /**
369
+ * The callback will be called once all listenables have triggered at least once.
370
+ * It will be invoked with the first emission from each listenable.
371
+ * @param {...Publishers} publishers Publishers that should be tracked.
372
+ * @param {Function|String} callback The method to call when all publishers have emitted
373
+ */
374
+ joinLeading: maker("first"),
375
+
376
+ /**
377
+ * The callback will be called once all listenables have triggered at least once.
378
+ * It will be invoked with all emission from each listenable.
379
+ * @param {...Publishers} publishers Publishers that should be tracked.
380
+ * @param {Function|String} callback The method to call when all publishers have emitted
381
+ */
382
+ joinConcat: maker("all"),
383
+
384
+ /**
385
+ * The callback will be called once all listenables have triggered.
386
+ * If a callback triggers twice before that happens, an error is thrown.
387
+ * @param {...Publishers} publishers Publishers that should be tracked.
388
+ * @param {Function|String} callback The method to call when all publishers have emitted
389
+ */
390
+ joinStrict: maker("strict"),
391
+ };
392
+
393
+
394
+ },{"./joins":10,"./utils":13}],4:[function(_dereq_,module,exports){
395
+ var _ = _dereq_('./utils'),
396
+ ListenerMethods = _dereq_('./ListenerMethods');
397
+
398
+ /**
399
+ * A module meant to be consumed as a mixin by a React component. Supplies the methods from
400
+ * `ListenerMethods` mixin and takes care of teardown of subscriptions.
401
+ */
402
+ module.exports = _.extend({
403
+
404
+ /**
405
+ * Cleans up all listener previously registered.
406
+ */
407
+ componentWillUnmount: ListenerMethods.stopListeningToAll
408
+
409
+ }, ListenerMethods);
410
+
411
+ },{"./ListenerMethods":3,"./utils":13}],5:[function(_dereq_,module,exports){
412
+ var _ = _dereq_('./utils');
413
+
414
+ /**
415
+ * A module of methods for object that you want to be able to listen to.
416
+ * This module is consumed by `createStore` and `createAction`
417
+ */
418
+ module.exports = {
419
+
420
+ /**
421
+ * Hook used by the publisher that is invoked before emitting
422
+ * and before `shouldEmit`. The arguments are the ones that the action
423
+ * is invoked with. If this function returns something other than
424
+ * undefined, that will be passed on as arguments for shouldEmit and
425
+ * emission.
426
+ */
427
+ preEmit: function() {},
428
+
429
+ /**
430
+ * Hook used by the publisher after `preEmit` to determine if the
431
+ * event should be emitted with given arguments. This may be overridden
432
+ * in your application, default implementation always returns true.
433
+ *
434
+ * @returns {Boolean} true if event should be emitted
435
+ */
436
+ shouldEmit: function() { return true; },
437
+
438
+ /**
439
+ * Subscribes the given callback for action triggered
440
+ *
441
+ * @param {Function} callback The callback to register as event handler
442
+ * @param {Mixed} [optional] bindContext The context to bind the callback with
443
+ * @returns {Function} Callback that unsubscribes the registered event handler
444
+ */
445
+ listen: function(callback, bindContext) {
446
+ var eventHandler = function(args) {
447
+ callback.apply(bindContext, args);
448
+ }, me = this;
449
+ this.emitter.addListener(this.eventLabel, eventHandler);
450
+ return function() {
451
+ me.emitter.removeListener(me.eventLabel, eventHandler);
452
+ };
453
+ },
454
+
455
+ /**
456
+ * Publishes an event using `this.emitter` (if `shouldEmit` agrees)
457
+ */
458
+ trigger: function() {
459
+ var args = arguments,
460
+ pre = this.preEmit.apply(this, args);
461
+ args = pre === undefined ? args : _.isArguments(pre) ? pre : [].concat(pre);
462
+ if (this.shouldEmit.apply(this, args)) {
463
+ this.emitter.emit(this.eventLabel, args);
464
+ }
465
+ },
466
+
467
+ /**
468
+ * Tries to publish the event on the next tick
469
+ */
470
+ triggerAsync: function(){
471
+ var args = arguments,me = this;
472
+ _.nextTick(function() {
473
+ me.trigger.apply(me, args);
474
+ });
475
+ }
476
+ };
477
+
478
+ },{"./utils":13}],6:[function(_dereq_,module,exports){
479
+ var Reflux = _dereq_('../src'),
480
+ _ = _dereq_('./utils');
481
+
482
+ module.exports = function(listenable,key){
483
+ return {
484
+ componentDidMount: function(){
485
+ for(var m in Reflux.ListenerMethods){
486
+ if (this[m] !== Reflux.ListenerMethods[m]){
487
+ if (this[m]){
488
+ throw "Can't have other property '"+m+"' when using Reflux.listenTo!";
489
+ }
490
+ this[m] = Reflux.ListenerMethods[m];
491
+ }
492
+ }
493
+ var me = this, cb = (key === undefined ? this.setState : function(v){me.setState(_.object([key],[v]));});
494
+ this.listenTo(listenable,cb,cb);
495
+ },
496
+ componentWillUnmount: Reflux.ListenerMixin.componentWillUnmount
497
+ };
498
+ };
499
+
500
+ },{"../src":9,"./utils":13}],7:[function(_dereq_,module,exports){
501
+ var _ = _dereq_('./utils'),
502
+ Reflux = _dereq_('../src'),
503
+ Keep = _dereq_('./Keep'),
504
+ allowed = {preEmit:1,shouldEmit:1};
505
+
506
+ /**
507
+ * Creates an action functor object. It is mixed in with functions
508
+ * from the `PublisherMethods` mixin. `preEmit` and `shouldEmit` may
509
+ * be overridden in the definition object.
510
+ *
511
+ * @param {Object} definition The action object definition
512
+ */
513
+ module.exports = function(definition) {
514
+
515
+ definition = definition || {};
516
+
517
+ for(var d in definition){
518
+ if (!allowed[d] && Reflux.PublisherMethods[d]) {
519
+ throw new Error("Cannot override API method " + d +
520
+ " in action creation. Use another method name or override it on Reflux.PublisherMethods instead."
521
+ );
522
+ }
523
+ }
524
+
525
+ var context = _.extend({
526
+ eventLabel: "action",
527
+ emitter: new _.EventEmitter(),
528
+ _isAction: true
529
+ },Reflux.PublisherMethods,definition);
530
+
531
+ var functor = function() {
532
+ functor[functor.sync?"trigger":"triggerAsync"].apply(functor, arguments);
533
+ };
534
+
535
+ _.extend(functor,context);
536
+
537
+ Keep.createdActions.push(functor);
538
+
539
+ return functor;
540
+
541
+ };
542
+
543
+ },{"../src":9,"./Keep":2,"./utils":13}],8:[function(_dereq_,module,exports){
544
+ var _ = _dereq_('./utils'),
545
+ Reflux = _dereq_('../src'),
546
+ Keep = _dereq_('./Keep'),
547
+ allowed = {preEmit:1,shouldEmit:1};
548
+
549
+ /**
550
+ * Creates an event emitting Data Store. It is mixed in with functions
551
+ * from the `ListenerMethods` and `PublisherMethods` mixins. `preEmit`
552
+ * and `shouldEmit` may be overridden in the definition object.
553
+ *
554
+ * @param {Object} definition The data store object definition
555
+ * @returns {Store} A data store instance
556
+ */
557
+ module.exports = function(definition) {
558
+
559
+ definition = definition || {};
560
+
561
+ for(var d in definition){
562
+ if (!allowed[d] && (Reflux.PublisherMethods[d] || Reflux.ListenerMethods[d])){
563
+ throw new Error("Cannot override API method " + d +
564
+ " in store creation. Use another method name or override it on Reflux.PublisherMethods / Reflux.ListenerMethods instead."
565
+ );
566
+ }
567
+ }
568
+
569
+ function Store() {
570
+ var i=0, arr;
571
+ this.subscriptions = [];
572
+ this.emitter = new _.EventEmitter();
573
+ this.eventLabel = "change";
574
+ if (this.init && _.isFunction(this.init)) {
575
+ this.init();
576
+ }
577
+ if (this.listenables){
578
+ arr = [].concat(this.listenables);
579
+ for(;i < arr.length;i++){
580
+ this.listenToMany(arr[i]);
581
+ }
582
+ }
583
+ }
584
+
585
+ _.extend(Store.prototype, Reflux.ListenerMethods, Reflux.PublisherMethods, definition);
586
+
587
+ var store = new Store();
588
+ Keep.createdStores.push(store);
589
+
590
+ return store;
591
+ };
592
+
593
+ },{"../src":9,"./Keep":2,"./utils":13}],9:[function(_dereq_,module,exports){
594
+ exports.ListenerMethods = _dereq_('./ListenerMethods');
595
+
596
+ exports.PublisherMethods = _dereq_('./PublisherMethods');
597
+
598
+ exports.createAction = _dereq_('./createAction');
599
+
600
+ exports.createStore = _dereq_('./createStore');
601
+
602
+ exports.connect = _dereq_('./connect');
603
+
604
+ exports.ListenerMixin = _dereq_('./ListenerMixin');
605
+
606
+ exports.listenTo = _dereq_('./listenTo');
607
+
608
+ exports.listenToMany = _dereq_('./listenToMany');
609
+
610
+
611
+ var maker = _dereq_('./joins').staticJoinCreator;
612
+
613
+ exports.joinTrailing = exports.all = maker("last"); // Reflux.all alias for backward compatibility
614
+
615
+ exports.joinLeading = maker("first");
616
+
617
+ exports.joinStrict = maker("strict");
618
+
619
+ exports.joinConcat = maker("all");
620
+
621
+
622
+ /**
623
+ * Convenience function for creating a set of actions
624
+ *
625
+ * @param actionNames the names for the actions to be created
626
+ * @returns an object with actions of corresponding action names
627
+ */
628
+ exports.createActions = function(actionNames) {
629
+ var i = 0, actions = {};
630
+ for (; i < actionNames.length; i++) {
631
+ actions[actionNames[i]] = exports.createAction();
632
+ }
633
+ return actions;
634
+ };
635
+
636
+ /**
637
+ * Sets the eventmitter that Reflux uses
638
+ */
639
+ exports.setEventEmitter = function(ctx) {
640
+ var _ = _dereq_('./utils');
641
+ _.EventEmitter = ctx;
642
+ };
643
+
644
+ /**
645
+ * Sets the method used for deferring actions and stores
646
+ */
647
+ exports.nextTick = function(nextTick) {
648
+ var _ = _dereq_('./utils');
649
+ _.nextTick = nextTick;
650
+ };
651
+
652
+ /**
653
+ * Provides the set of created actions and stores for introspection
654
+ */
655
+ exports.__keep = _dereq_('./Keep');
656
+
657
+ },{"./Keep":2,"./ListenerMethods":3,"./ListenerMixin":4,"./PublisherMethods":5,"./connect":6,"./createAction":7,"./createStore":8,"./joins":10,"./listenTo":11,"./listenToMany":12,"./utils":13}],10:[function(_dereq_,module,exports){
658
+ /**
659
+ * Internal module used to create static and instance join methods
660
+ */
661
+
662
+ var slice = Array.prototype.slice,
663
+ createStore = _dereq_("./createStore"),
664
+ strategyMethodNames = {
665
+ strict: "joinStrict",
666
+ first: "joinLeading",
667
+ last: "joinTrailing",
668
+ all: "joinConcat"
669
+ };
670
+
671
+ /**
672
+ * Used in `index.js` to create the static join methods
673
+ * @param {String} strategy Which strategy to use when tracking listenable trigger arguments
674
+ * @returns {Function} A static function which returns a store with a join listen on the given listenables using the given strategy
675
+ */
676
+ exports.staticJoinCreator = function(strategy){
677
+ return function(/* listenables... */) {
678
+ var listenables = slice.call(arguments);
679
+ return createStore({
680
+ init: function(){
681
+ this[strategyMethodNames[strategy]].apply(this,listenables.concat("triggerAsync"));
682
+ }
683
+ });
684
+ };
685
+ };
686
+
687
+ /**
688
+ * Used in `ListenerMethods.js` to create the instance join methods
689
+ * @param {String} strategy Which strategy to use when tracking listenable trigger arguments
690
+ * @returns {Function} An instance method which sets up a join listen on the given listenables using the given strategy
691
+ */
692
+ exports.instanceJoinCreator = function(strategy){
693
+ return function(/* listenables..., callback*/){
694
+ var listenables = slice.call(arguments),
695
+ callback = listenables.pop(),
696
+ numberOfListenables = listenables.length,
697
+ join = {
698
+ numberOfListenables: numberOfListenables,
699
+ callback: this[callback]||callback,
700
+ listener: this,
701
+ strategy: strategy
702
+ };
703
+ for (var i = 0; i < numberOfListenables; i++) {
704
+ this.listenTo(listenables[i],newListener(i,join));
705
+ }
706
+ reset(join);
707
+ };
708
+ };
709
+
710
+ // ---- internal join functions ----
711
+
712
+ function reset(join) {
713
+ join.listenablesEmitted = new Array(join.numberOfListenables);
714
+ join.args = new Array(join.numberOfListenables);
715
+ }
716
+
717
+ function newListener(i,join) {
718
+ return function() {
719
+ var callargs = slice.call(arguments);
720
+ if (join.listenablesEmitted[i]){
721
+ switch(join.strategy){
722
+ case "strict": throw new Error("Strict join failed because listener triggered twice.");
723
+ case "last": join.args[i] = callargs; break;
724
+ case "all": join.args[i].push(callargs);
725
+ }
726
+ } else {
727
+ join.listenablesEmitted[i] = true;
728
+ join.args[i] = (join.strategy==="all"?[callargs]:callargs);
729
+ }
730
+ emitIfAllListenablesEmitted(join);
731
+ };
732
+ }
733
+
734
+ function emitIfAllListenablesEmitted(join) {
735
+ for (var i = 0; i < join.numberOfListenables; i++) {
736
+ if (!join.listenablesEmitted[i]) {
737
+ return;
738
+ }
739
+ }
740
+ join.callback.apply(join.listener,join.args);
741
+ reset(join);
742
+ }
743
+
744
+ },{"./createStore":8}],11:[function(_dereq_,module,exports){
745
+ var Reflux = _dereq_('../src');
746
+
747
+
748
+ /**
749
+ * A mixin factory for a React component. Meant as a more convenient way of using the `ListenerMixin`,
750
+ * without having to manually set listeners in the `componentDidMount` method.
751
+ *
752
+ * @param {Action|Store} listenable An Action or Store that should be
753
+ * listened to.
754
+ * @param {Function|String} callback The callback to register as event handler
755
+ * @param {Function|String} defaultCallback The callback to register as default handler
756
+ * @returns {Object} An object to be used as a mixin, which sets up the listener for the given listenable.
757
+ */
758
+ module.exports = function(listenable,callback,initial){
759
+ return {
760
+ /**
761
+ * Set up the mixin before the initial rendering occurs. Import methods from `ListenerMethods`
762
+ * and then make the call to `listenTo` with the arguments provided to the factory function
763
+ */
764
+ componentDidMount: function() {
765
+ for(var m in Reflux.ListenerMethods){
766
+ if (this[m] !== Reflux.ListenerMethods[m]){
767
+ if (this[m]){
768
+ throw "Can't have other property '"+m+"' when using Reflux.listenTo!";
769
+ }
770
+ this[m] = Reflux.ListenerMethods[m];
771
+ }
772
+ }
773
+ this.listenTo(listenable,callback,initial);
774
+ },
775
+ /**
776
+ * Cleans up all listener previously registered.
777
+ */
778
+ componentWillUnmount: Reflux.ListenerMethods.stopListeningToAll
779
+ };
780
+ };
781
+
782
+ },{"../src":9}],12:[function(_dereq_,module,exports){
783
+ var Reflux = _dereq_('../src');
784
+
785
+ /**
786
+ * A mixin factory for a React component. Meant as a more convenient way of using the `listenerMixin`,
787
+ * without having to manually set listeners in the `componentDidMount` method. This version is used
788
+ * to automatically set up a `listenToMany` call.
789
+ *
790
+ * @param {Object} listenables An object of listenables
791
+ * @returns {Object} An object to be used as a mixin, which sets up the listeners for the given listenables.
792
+ */
793
+ module.exports = function(listenables){
794
+ return {
795
+ /**
796
+ * Set up the mixin before the initial rendering occurs. Import methods from `ListenerMethods`
797
+ * and then make the call to `listenTo` with the arguments provided to the factory function
798
+ */
799
+ componentDidMount: function() {
800
+ for(var m in Reflux.ListenerMethods){
801
+ if (this[m] !== Reflux.ListenerMethods[m]){
802
+ if (this[m]){
803
+ throw "Can't have other property '"+m+"' when using Reflux.listenToMany!";
804
+ }
805
+ this[m] = Reflux.ListenerMethods[m];
806
+ }
807
+ }
808
+ this.listenToMany(listenables);
809
+ },
810
+ /**
811
+ * Cleans up all listener previously registered.
812
+ */
813
+ componentWillUnmount: Reflux.ListenerMethods.stopListeningToAll
814
+ };
815
+ };
816
+
817
+ },{"../src":9}],13:[function(_dereq_,module,exports){
818
+ /*
819
+ * isObject, extend, isFunction, isArguments are taken from undescore/lodash in
820
+ * order to remove the dependency
821
+ */
822
+ var isObject = exports.isObject = function(obj) {
823
+ var type = typeof obj;
824
+ return type === 'function' || type === 'object' && !!obj;
825
+ };
826
+
827
+ exports.extend = function(obj) {
828
+ if (!isObject(obj)) {
829
+ return obj;
830
+ }
831
+ var source, prop;
832
+ for (var i = 1, length = arguments.length; i < length; i++) {
833
+ source = arguments[i];
834
+ for (prop in source) {
835
+ obj[prop] = source[prop];
836
+ }
837
+ }
838
+ return obj;
839
+ };
840
+
841
+ exports.isFunction = function(value) {
842
+ return typeof value === 'function';
843
+ };
844
+
845
+ exports.EventEmitter = _dereq_('eventemitter3');
846
+
847
+ exports.nextTick = function(callback) {
848
+ setTimeout(callback, 0);
849
+ };
850
+
851
+ exports.callbackName = function(string){
852
+ return "on"+string.charAt(0).toUpperCase()+string.slice(1);
853
+ };
854
+
855
+ exports.object = function(keys,vals){
856
+ var o={}, i=0;
857
+ for(;i<keys.length;i++){
858
+ o[keys[i]] = vals[i];
859
+ }
860
+ return o;
861
+ };
862
+
863
+ exports.isArguments = function(value) {
864
+ return value && typeof value == 'object' && typeof value.length == 'number' &&
865
+ (toString.call(value) === '[object Arguments]' || (hasOwnProperty.call(value, 'callee' && !propertyIsEnumerable.call(value, 'callee')))) || false;
866
+ };
867
+
868
+ exports.throwIf = function(val,msg){
869
+ if (val){
870
+ throw Error(msg||val);
871
+ }
872
+ };
873
+
874
+ },{"eventemitter3":1}]},{},[9])
875
+ (9)
876
+ });
@@ -0,0 +1 @@
1
+ !function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;"undefined"!=typeof window?b=window:"undefined"!=typeof global?b=global:"undefined"!=typeof self&&(b=self),b.Reflux=a()}}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);throw new Error("Cannot find module '"+g+"'")}var j=c[g]={exports:{}};b[g][0].call(j.exports,function(a){var c=b[g][1][a];return e(c?c:a)},j,j.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b){"use strict";function c(a,b,c){this.fn=a,this.context=b,this.once=c||!1}function d(){}d.prototype._events=void 0,d.prototype.listeners=function(a){if(!this._events||!this._events[a])return[];for(var b=0,c=this._events[a].length,d=[];c>b;b++)d.push(this._events[a][b].fn);return d},d.prototype.emit=function(a,b,c,d,e,f){if(!this._events||!this._events[a])return!1;var g,h,i,j=this._events[a],k=j.length,l=arguments.length,m=j[0];if(1===k){switch(m.once&&this.removeListener(a,m.fn,!0),l){case 1:return m.fn.call(m.context),!0;case 2:return m.fn.call(m.context,b),!0;case 3:return m.fn.call(m.context,b,c),!0;case 4:return m.fn.call(m.context,b,c,d),!0;case 5:return m.fn.call(m.context,b,c,d,e),!0;case 6:return m.fn.call(m.context,b,c,d,e,f),!0}for(h=1,g=new Array(l-1);l>h;h++)g[h-1]=arguments[h];m.fn.apply(m.context,g)}else for(h=0;k>h;h++)switch(j[h].once&&this.removeListener(a,j[h].fn,!0),l){case 1:j[h].fn.call(j[h].context);break;case 2:j[h].fn.call(j[h].context,b);break;case 3:j[h].fn.call(j[h].context,b,c);break;default:if(!g)for(i=1,g=new Array(l-1);l>i;i++)g[i-1]=arguments[i];j[h].fn.apply(j[h].context,g)}return!0},d.prototype.on=function(a,b,d){return this._events||(this._events={}),this._events[a]||(this._events[a]=[]),this._events[a].push(new c(b,d||this)),this},d.prototype.once=function(a,b,d){return this._events||(this._events={}),this._events[a]||(this._events[a]=[]),this._events[a].push(new c(b,d||this,!0)),this},d.prototype.removeListener=function(a,b,c){if(!this._events||!this._events[a])return this;var d=this._events[a],e=[];if(b)for(var f=0,g=d.length;g>f;f++)d[f].fn!==b&&d[f].once!==c&&e.push(d[f]);return this._events[a]=e.length?e:null,this},d.prototype.removeAllListeners=function(a){return this._events?(a?this._events[a]=null:this._events={},this):this},d.prototype.off=d.prototype.removeListener,d.prototype.addListener=d.prototype.on,d.prototype.setMaxListeners=function(){return this},d.EventEmitter=d,d.EventEmitter2=d,d.EventEmitter3=d,"object"==typeof b&&b.exports&&(b.exports=d)},{}],2:[function(a,b,c){c.createdStores=[],c.createdActions=[],c.reset=function(){for(;c.createdStores.length;)c.createdStores.pop();for(;c.createdActions.length;)c.createdActions.pop()}},{}],3:[function(a,b){var c=a("./utils"),d=a("./joins").instanceJoinCreator;b.exports={hasListener:function(a){for(var b,c=0;c<(this.subscriptions||[]).length;++c)if(b=this.subscriptions[c].listenable,b===a||b.hasListener&&b.hasListener(a))return!0;return!1},listenToMany:function(a){for(var b in a){var d=c.callbackName(b),e=this[d]?d:this[b]?b:void 0;e&&this.listenTo(a[b],e,this[d+"Default"]||this[e+"Default"]||e)}},validateListening:function(a){return a===this?"Listener is not able to listen to itself":c.isFunction(a.listen)?a.hasListener&&a.hasListener(this)?"Listener cannot listen to this listenable because of circular loop":void 0:a+" is missing a listen method"},listenTo:function(a,b,d){var e,f,g,h=this.subscriptions=this.subscriptions||[];return c.throwIf(this.validateListening(a)),this.fetchDefaultData(a,d),e=a.listen(this[b]||b,this),f=function(){var a=h.indexOf(g);c.throwIf(-1===a,"Tried to remove listen already gone from subscriptions list!"),h.splice(a,1),e()},g={stop:f,listenable:a},h.push(g),g},stopListeningTo:function(a){for(var b,d=0,e=this.subscriptions||[];d<e.length;d++)if(b=e[d],b.listenable===a)return b.stop(),c.throwIf(-1!==e.indexOf(b),"Failed to remove listen from subscriptions list!"),!0;return!1},stopListeningToAll:function(){for(var a,b=this.subscriptions||[];a=b.length;)b[0].stop(),c.throwIf(b.length!==a-1,"Failed to remove listen from subscriptions list!")},fetchDefaultData:function(a,b){b=b&&this[b]||b;var d=this;c.isFunction(b)&&c.isFunction(a.getDefaultData)&&(data=a.getDefaultData(),data&&c.isFunction(data.then)?data.then(function(){b.apply(d,arguments)}):b.call(this,data))},joinTrailing:d("last"),joinLeading:d("first"),joinConcat:d("all"),joinStrict:d("strict")}},{"./joins":10,"./utils":13}],4:[function(a,b){var c=a("./utils"),d=a("./ListenerMethods");b.exports=c.extend({componentWillUnmount:d.stopListeningToAll},d)},{"./ListenerMethods":3,"./utils":13}],5:[function(a,b){var c=a("./utils");b.exports={preEmit:function(){},shouldEmit:function(){return!0},listen:function(a,b){var c=function(c){a.apply(b,c)},d=this;return this.emitter.addListener(this.eventLabel,c),function(){d.emitter.removeListener(d.eventLabel,c)}},trigger:function(){var a=arguments,b=this.preEmit.apply(this,a);a=void 0===b?a:c.isArguments(b)?b:[].concat(b),this.shouldEmit.apply(this,a)&&this.emitter.emit(this.eventLabel,a)},triggerAsync:function(){var a=arguments,b=this;c.nextTick(function(){b.trigger.apply(b,a)})}}},{"./utils":13}],6:[function(a,b){var c=a("../src"),d=a("./utils");b.exports=function(a,b){return{componentDidMount:function(){for(var e in c.ListenerMethods)if(this[e]!==c.ListenerMethods[e]){if(this[e])throw"Can't have other property '"+e+"' when using Reflux.listenTo!";this[e]=c.ListenerMethods[e]}var f=this,g=void 0===b?this.setState:function(a){f.setState(d.object([b],[a]))};this.listenTo(a,g,g)},componentWillUnmount:c.ListenerMixin.componentWillUnmount}}},{"../src":9,"./utils":13}],7:[function(a,b){var c=a("./utils"),d=a("../src"),e=a("./Keep"),f={preEmit:1,shouldEmit:1};b.exports=function(a){a=a||{};for(var b in a)if(!f[b]&&d.PublisherMethods[b])throw new Error("Cannot override API method "+b+" in action creation. Use another method name or override it on Reflux.PublisherMethods instead.");var g=c.extend({eventLabel:"action",emitter:new c.EventEmitter,_isAction:!0},d.PublisherMethods,a),h=function(){h[h.sync?"trigger":"triggerAsync"].apply(h,arguments)};return c.extend(h,g),e.createdActions.push(h),h}},{"../src":9,"./Keep":2,"./utils":13}],8:[function(a,b){var c=a("./utils"),d=a("../src"),e=a("./Keep"),f={preEmit:1,shouldEmit:1};b.exports=function(a){function b(){var a,b=0;if(this.subscriptions=[],this.emitter=new c.EventEmitter,this.eventLabel="change",this.init&&c.isFunction(this.init)&&this.init(),this.listenables)for(a=[].concat(this.listenables);b<a.length;b++)this.listenToMany(a[b])}a=a||{};for(var g in a)if(!f[g]&&(d.PublisherMethods[g]||d.ListenerMethods[g]))throw new Error("Cannot override API method "+g+" in store creation. Use another method name or override it on Reflux.PublisherMethods / Reflux.ListenerMethods instead.");c.extend(b.prototype,d.ListenerMethods,d.PublisherMethods,a);var h=new b;return e.createdStores.push(h),h}},{"../src":9,"./Keep":2,"./utils":13}],9:[function(a,b,c){c.ListenerMethods=a("./ListenerMethods"),c.PublisherMethods=a("./PublisherMethods"),c.createAction=a("./createAction"),c.createStore=a("./createStore"),c.connect=a("./connect"),c.ListenerMixin=a("./ListenerMixin"),c.listenTo=a("./listenTo"),c.listenToMany=a("./listenToMany");var d=a("./joins").staticJoinCreator;c.joinTrailing=c.all=d("last"),c.joinLeading=d("first"),c.joinStrict=d("strict"),c.joinConcat=d("all"),c.createActions=function(a){for(var b=0,d={};b<a.length;b++)d[a[b]]=c.createAction();return d},c.setEventEmitter=function(b){var c=a("./utils");c.EventEmitter=b},c.nextTick=function(b){var c=a("./utils");c.nextTick=b},c.__keep=a("./Keep")},{"./Keep":2,"./ListenerMethods":3,"./ListenerMixin":4,"./PublisherMethods":5,"./connect":6,"./createAction":7,"./createStore":8,"./joins":10,"./listenTo":11,"./listenToMany":12,"./utils":13}],10:[function(a,b,c){function d(a){a.listenablesEmitted=new Array(a.numberOfListenables),a.args=new Array(a.numberOfListenables)}function e(a,b){return function(){var c=g.call(arguments);if(b.listenablesEmitted[a])switch(b.strategy){case"strict":throw new Error("Strict join failed because listener triggered twice.");case"last":b.args[a]=c;break;case"all":b.args[a].push(c)}else b.listenablesEmitted[a]=!0,b.args[a]="all"===b.strategy?[c]:c;f(b)}}function f(a){for(var b=0;b<a.numberOfListenables;b++)if(!a.listenablesEmitted[b])return;a.callback.apply(a.listener,a.args),d(a)}var g=Array.prototype.slice,h=a("./createStore"),i={strict:"joinStrict",first:"joinLeading",last:"joinTrailing",all:"joinConcat"};c.staticJoinCreator=function(a){return function(){var b=g.call(arguments);return h({init:function(){this[i[a]].apply(this,b.concat("triggerAsync"))}})}},c.instanceJoinCreator=function(a){return function(){for(var b=g.call(arguments),c=b.pop(),f=b.length,h={numberOfListenables:f,callback:this[c]||c,listener:this,strategy:a},i=0;f>i;i++)this.listenTo(b[i],e(i,h));d(h)}}},{"./createStore":8}],11:[function(a,b){var c=a("../src");b.exports=function(a,b,d){return{componentDidMount:function(){for(var e in c.ListenerMethods)if(this[e]!==c.ListenerMethods[e]){if(this[e])throw"Can't have other property '"+e+"' when using Reflux.listenTo!";this[e]=c.ListenerMethods[e]}this.listenTo(a,b,d)},componentWillUnmount:c.ListenerMethods.stopListeningToAll}}},{"../src":9}],12:[function(a,b){var c=a("../src");b.exports=function(a){return{componentDidMount:function(){for(var b in c.ListenerMethods)if(this[b]!==c.ListenerMethods[b]){if(this[b])throw"Can't have other property '"+b+"' when using Reflux.listenToMany!";this[b]=c.ListenerMethods[b]}this.listenToMany(a)},componentWillUnmount:c.ListenerMethods.stopListeningToAll}}},{"../src":9}],13:[function(a,b,c){var d=c.isObject=function(a){var b=typeof a;return"function"===b||"object"===b&&!!a};c.extend=function(a){if(!d(a))return a;for(var b,c,e=1,f=arguments.length;f>e;e++){b=arguments[e];for(c in b)a[c]=b[c]}return a},c.isFunction=function(a){return"function"==typeof a},c.EventEmitter=a("eventemitter3"),c.nextTick=function(a){setTimeout(a,0)},c.callbackName=function(a){return"on"+a.charAt(0).toUpperCase()+a.slice(1)},c.object=function(a,b){for(var c={},d=0;d<a.length;d++)c[a[d]]=b[d];return c},c.isArguments=function(a){return a&&"object"==typeof a&&"number"==typeof a.length&&("[object Arguments]"===toString.call(a)||hasOwnProperty.call(a,"callee"&&!propertyIsEnumerable.call(a,"callee")))||!1},c.throwIf=function(a,b){if(a)throw Error(b||a)}},{eventemitter3:1}]},{},[9])(9)});
metadata ADDED
@@ -0,0 +1,84 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: reflux-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.15
5
+ platform: ruby
6
+ authors:
7
+ - Wontae Yang
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-11-05 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ description: this is a Ruby gem for building reflux application
42
+ email:
43
+ - wontaeyang@gmail.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - .gitignore
49
+ - Gemfile
50
+ - LICENSE.txt
51
+ - README.md
52
+ - Rakefile
53
+ - lib/reflux/rails.rb
54
+ - lib/reflux/rails/engine.rb
55
+ - lib/reflux/rails/railtie.rb
56
+ - lib/reflux/rails/version.rb
57
+ - reflux-rails.gemspec
58
+ - vendor/assets/javascripts/reflux.js
59
+ - vendor/assets/javascripts/reflux.min.js
60
+ homepage: https://github.com/wontaeyang/reflux-rails
61
+ licenses:
62
+ - MIT
63
+ metadata: {}
64
+ post_install_message:
65
+ rdoc_options: []
66
+ require_paths:
67
+ - lib
68
+ required_ruby_version: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - '>='
71
+ - !ruby/object:Gem::Version
72
+ version: '0'
73
+ required_rubygems_version: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ requirements: []
79
+ rubyforge_project:
80
+ rubygems_version: 2.4.2
81
+ signing_key:
82
+ specification_version: 4
83
+ summary: refluxjs gem for rails
84
+ test_files: []