flux-rails 0.0.1 → 2.0.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6ab1c91d3011d5aa6ea582897fd67382ad5da3b1
4
- data.tar.gz: 7a8b4b679d50cc9101dad38f199462739556bc71
3
+ metadata.gz: 1e888fccd2c051cfef1ef26efd33ee0c0b164fe9
4
+ data.tar.gz: dd88520658afa906fe9124b886d6a02af89e5a31
5
5
  SHA512:
6
- metadata.gz: 18bb9ae4777e9c3fb5bccc975602ac04d1b015e53dcba2bc7d9f609e1db15a9ebe2af005d1479e85c737e95c9aff8c317cf421babc6344478f0bf5a36779d65f
7
- data.tar.gz: 085bc5307ff97fe855e7255dfb36bdbb322fcee807ce41a2ab6aa439df8fef738788db34bb3dc9793d99f190fd411184ddd1ecf6511945f7151ef48877bb9cca
6
+ metadata.gz: 700a132a520c67ac9953a4e89ac734658a3aebc5aa07094a6370cedb040d87a56fca18cbf8a62c751282feec4518acd5f0e032135cf78e9cd18639a304c7cfcc
7
+ data.tar.gz: cdc2e7f07c6b5ba2d4a3d08806ab9bb66c1868340bfc4a6a297a18064493ed654b64afc92a425e0c376459dfe56c598f6d036126252a91e41d6b76551c9ac6ec
data/README.md CHANGED
@@ -1,14 +1,19 @@
1
- # Flux::Rails
1
+ # flux-rails
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/flux-rails.svg)](https://badge.fury.io/rb/flux-rails.svg)
4
+
5
+ [Flux](https://github.com/facebook/flux) for Rails Asset Pipeline
6
+
7
+ - Flux version: [2.0.2](https://github.com/facebook/flux/releases/tag/2.0.2)
2
8
 
3
- TODO: Write a gem description
4
9
 
5
10
  ## Installation
6
11
 
7
12
  Add this line to your application's Gemfile:
8
13
 
9
- ```ruby
10
- gem 'flux-rails'
11
- ```
14
+ ```ruby
15
+ gem 'flux-rails'
16
+ ```
12
17
 
13
18
  And then execute:
14
19
 
@@ -20,12 +25,22 @@ Or install it yourself as:
20
25
 
21
26
  ## Usage
22
27
 
23
- TODO: Write usage instructions here
28
+ Require flux in your application.js
29
+
30
+ ```js
31
+ //= require flux
32
+ ```
24
33
 
25
34
  ## Contributing
26
35
 
27
- 1. Fork it ( https://github.com/[my-github-username]/flux-rails/fork )
36
+ 1. Fork it ( https://github.com/mariopeixoto/flux-rails/fork )
28
37
  2. Create your feature branch (`git checkout -b my-new-feature`)
29
38
  3. Commit your changes (`git commit -am 'Add some feature'`)
30
39
  4. Push to the branch (`git push origin my-new-feature`)
31
40
  5. Create a new Pull Request
41
+
42
+ ## Acknowledgements
43
+
44
+ [Flux](https://github.com/facebook/flux) by [Facebook](http://www.facebook.com)
45
+
46
+ Copyright [Mario Peixoto](https://github.com/mariopeixoto), released under the [MIT license](https://github.com/mariopeixoto/flux-rails/LICENSE).
@@ -1,5 +1,5 @@
1
1
  module Flux
2
2
  module Rails
3
- VERSION = "0.0.1"
3
+ VERSION = "2.0.2"
4
4
  end
5
5
  end
@@ -11,7 +11,7 @@
11
11
  module.exports.Dispatcher = require('./lib/Dispatcher')
12
12
 
13
13
  },{"./lib/Dispatcher":2}],2:[function(require,module,exports){
14
- /**
14
+ /*
15
15
  * Copyright (c) 2014, Facebook, Inc.
16
16
  * All rights reserved.
17
17
  *
@@ -21,7 +21,6 @@ module.exports.Dispatcher = require('./lib/Dispatcher')
21
21
  *
22
22
  * @providesModule Dispatcher
23
23
  * @typechecks
24
- * @preventMunge
25
24
  */
26
25
 
27
26
  "use strict";
@@ -106,11 +105,15 @@ var _prefix = 'ID_';
106
105
  * flightDispatcher.register(function(payload) {
107
106
  * switch (payload.actionType) {
108
107
  * case 'country-update':
109
- * case 'city-update':
110
108
  * flightDispatcher.waitFor([CityStore.dispatchToken]);
111
109
  * FlightPriceStore.price =
112
110
  * getFlightPriceStore(CountryStore.country, CityStore.city);
113
111
  * break;
112
+ *
113
+ * case 'city-update':
114
+ * FlightPriceStore.price =
115
+ * FlightPriceStore(CountryStore.country, CityStore.city);
116
+ * break;
114
117
  * }
115
118
  * });
116
119
  *
@@ -120,11 +123,11 @@ var _prefix = 'ID_';
120
123
  */
121
124
 
122
125
  function Dispatcher() {
123
- this._callbacks = {};
124
- this._isPending = {};
125
- this._isHandled = {};
126
- this._isDispatching = false;
127
- this._pendingPayload = null;
126
+ this.$Dispatcher_callbacks = {};
127
+ this.$Dispatcher_isPending = {};
128
+ this.$Dispatcher_isHandled = {};
129
+ this.$Dispatcher_isDispatching = false;
130
+ this.$Dispatcher_pendingPayload = null;
128
131
  }
129
132
 
130
133
  /**
@@ -136,7 +139,7 @@ var _prefix = 'ID_';
136
139
  */
137
140
  Dispatcher.prototype.register=function(callback) {
138
141
  var id = _prefix + _lastID++;
139
- this._callbacks[id] = callback;
142
+ this.$Dispatcher_callbacks[id] = callback;
140
143
  return id;
141
144
  };
142
145
 
@@ -147,11 +150,11 @@ var _prefix = 'ID_';
147
150
  */
148
151
  Dispatcher.prototype.unregister=function(id) {
149
152
  invariant(
150
- this._callbacks[id],
153
+ this.$Dispatcher_callbacks[id],
151
154
  'Dispatcher.unregister(...): `%s` does not map to a registered callback.',
152
155
  id
153
156
  );
154
- delete this._callbacks[id];
157
+ delete this.$Dispatcher_callbacks[id];
155
158
  };
156
159
 
157
160
  /**
@@ -163,14 +166,14 @@ var _prefix = 'ID_';
163
166
  */
164
167
  Dispatcher.prototype.waitFor=function(ids) {
165
168
  invariant(
166
- this._isDispatching,
169
+ this.$Dispatcher_isDispatching,
167
170
  'Dispatcher.waitFor(...): Must be invoked while dispatching.'
168
171
  );
169
172
  for (var ii = 0; ii < ids.length; ii++) {
170
173
  var id = ids[ii];
171
- if (this._isPending[id]) {
174
+ if (this.$Dispatcher_isPending[id]) {
172
175
  invariant(
173
- this._isHandled[id],
176
+ this.$Dispatcher_isHandled[id],
174
177
  'Dispatcher.waitFor(...): Circular dependency detected while ' +
175
178
  'waiting for `%s`.',
176
179
  id
@@ -178,11 +181,11 @@ var _prefix = 'ID_';
178
181
  continue;
179
182
  }
180
183
  invariant(
181
- this._callbacks[id],
184
+ this.$Dispatcher_callbacks[id],
182
185
  'Dispatcher.waitFor(...): `%s` does not map to a registered callback.',
183
186
  id
184
187
  );
185
- this._invokeCallback(id);
188
+ this.$Dispatcher_invokeCallback(id);
186
189
  }
187
190
  };
188
191
 
@@ -193,19 +196,19 @@ var _prefix = 'ID_';
193
196
  */
194
197
  Dispatcher.prototype.dispatch=function(payload) {
195
198
  invariant(
196
- !this._isDispatching,
199
+ !this.$Dispatcher_isDispatching,
197
200
  'Dispatch.dispatch(...): Cannot dispatch in the middle of a dispatch.'
198
201
  );
199
- this._startDispatching(payload);
202
+ this.$Dispatcher_startDispatching(payload);
200
203
  try {
201
- for (var id in this._callbacks) {
202
- if (this._isPending[id]) {
204
+ for (var id in this.$Dispatcher_callbacks) {
205
+ if (this.$Dispatcher_isPending[id]) {
203
206
  continue;
204
207
  }
205
- this._invokeCallback(id);
208
+ this.$Dispatcher_invokeCallback(id);
206
209
  }
207
210
  } finally {
208
- this._stopDispatching();
211
+ this.$Dispatcher_stopDispatching();
209
212
  }
210
213
  };
211
214
 
@@ -215,7 +218,7 @@ var _prefix = 'ID_';
215
218
  * @return {boolean}
216
219
  */
217
220
  Dispatcher.prototype.isDispatching=function() {
218
- return this._isDispatching;
221
+ return this.$Dispatcher_isDispatching;
219
222
  };
220
223
 
221
224
  /**
@@ -225,10 +228,10 @@ var _prefix = 'ID_';
225
228
  * @param {string} id
226
229
  * @internal
227
230
  */
228
- Dispatcher.prototype._invokeCallback=function(id) {
229
- this._isPending[id] = true;
230
- this._callbacks[id](this._pendingPayload);
231
- this._isHandled[id] = true;
231
+ Dispatcher.prototype.$Dispatcher_invokeCallback=function(id) {
232
+ this.$Dispatcher_isPending[id] = true;
233
+ this.$Dispatcher_callbacks[id](this.$Dispatcher_pendingPayload);
234
+ this.$Dispatcher_isHandled[id] = true;
232
235
  };
233
236
 
234
237
  /**
@@ -237,13 +240,13 @@ var _prefix = 'ID_';
237
240
  * @param {object} payload
238
241
  * @internal
239
242
  */
240
- Dispatcher.prototype._startDispatching=function(payload) {
241
- for (var id in this._callbacks) {
242
- this._isPending[id] = false;
243
- this._isHandled[id] = false;
243
+ Dispatcher.prototype.$Dispatcher_startDispatching=function(payload) {
244
+ for (var id in this.$Dispatcher_callbacks) {
245
+ this.$Dispatcher_isPending[id] = false;
246
+ this.$Dispatcher_isHandled[id] = false;
244
247
  }
245
- this._pendingPayload = payload;
246
- this._isDispatching = true;
248
+ this.$Dispatcher_pendingPayload = payload;
249
+ this.$Dispatcher_isDispatching = true;
247
250
  };
248
251
 
249
252
  /**
@@ -251,9 +254,9 @@ var _prefix = 'ID_';
251
254
  *
252
255
  * @internal
253
256
  */
254
- Dispatcher.prototype._stopDispatching=function() {
255
- this._pendingPayload = null;
256
- this._isDispatching = false;
257
+ Dispatcher.prototype.$Dispatcher_stopDispatching=function() {
258
+ this.$Dispatcher_pendingPayload = null;
259
+ this.$Dispatcher_isDispatching = false;
257
260
  };
258
261
 
259
262
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flux-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mario Peixoto