Skip to content

Commit 470bff8

Browse files
committed
Merge pull request #96 from f/trigger_mixin
fix some formatting and run the build
2 parents a86c138 + 0eaa9df commit 470bff8

File tree

5 files changed

+18
-17
lines changed

5 files changed

+18
-17
lines changed

dist/delorean.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! delorean - v0.9.6-0 - 2015-08-24 */
1+
/*! delorean - v0.9.8 - 2016-05-23 */
22
(function (DeLorean) {
33
'use strict';
44

@@ -99,7 +99,6 @@
9999
DeLorean.EventEmitter.defaultMaxListeners = 50;
100100
this.listener = new DeLorean.EventEmitter();
101101
this.stores = stores;
102-
103102
/* Stores should be listened for rollback events. */
104103
__rollbackListener(Object.keys(stores).map(function (key) {
105104
return stores[key];
@@ -567,6 +566,17 @@
567566

568567
// ## Built-in React Mixin
569568
DeLorean.Flux.mixins = {
569+
570+
// This mixin adds the this.trigger method to the component
571+
// Components can then trigger actions in flux w/out watching stores and having their state
572+
trigger: {
573+
componentWillMount: function () {
574+
this.__dispatcher = __findDispatcher(this);
575+
},
576+
trigger: function () {
577+
this.__dispatcher.emit.apply(this.__dispatcher, arguments);
578+
}
579+
},
570580
// It should be inserted to the React components which
571581
// used in Flux.
572582
// Simply `mixin: [Flux.mixins.storeListener]` will work.

dist/delorean.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/delorean.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/delorean.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@
9898
DeLorean.EventEmitter.defaultMaxListeners = 50;
9999
this.listener = new DeLorean.EventEmitter();
100100
this.stores = stores;
101-
102101
/* Stores should be listened for rollback events. */
103102
__rollbackListener(Object.keys(stores).map(function (key) {
104103
return stores[key];
@@ -570,17 +569,13 @@
570569
// This mixin adds the this.trigger method to the component
571570
// Components can then trigger actions in flux w/out watching stores and having their state
572571
trigger: {
573-
574572
componentWillMount: function () {
575573
this.__dispatcher = __findDispatcher(this);
576574
},
577-
578575
trigger: function () {
579576
this.__dispatcher.emit.apply(this.__dispatcher, arguments);
580577
}
581-
582578
},
583-
584579
// It should be inserted to the React components which
585580
// used in Flux.
586581
// Simply `mixin: [Flux.mixins.storeListener]` will work.

test/spec/core/fluxSpec.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -95,22 +95,18 @@ describe('Flux', function () {
9595
});
9696

9797
it('should cleanup unused events after firing an action handler', function () {
98-
MyAppDispatcher.dispatch('noChange', 'someText')
99-
MyAppDispatcher.dispatch('noChange', 'someText')
100-
MyAppDispatcher.dispatch('noChange', 'someText')
101-
MyAppDispatcher.dispatch('noChange', 'someText')
102-
98+
MyAppDispatcher.dispatch('noChange', 'someText');
99+
MyAppDispatcher.dispatch('noChange', 'someText');
100+
MyAppDispatcher.dispatch('noChange', 'someText');
101+
MyAppDispatcher.dispatch('noChange', 'someText');
103102
changeListenerCount = myStore.listener.listeners('change').length;
104103
rollbackListenerCount = myStore.listener.listeners('rollback').length;
105-
106104
// Note that the 'cleanup_{actionName}' event has not fired yet and removed the last 2 events (change & rolback), so there will be one remaining of each event at this point.
107105
// however, without the cleanup, there would be 4 of each after 4 calls
108106
expect(changeListenerCount).toEqual(1);
109107
expect(rollbackListenerCount).toEqual(1);
110-
111108
});
112109

113-
114110
it('dispatcher can listen events', function () {
115111
var spy = jasmine.createSpy('dispatcher listener');
116112
MyAppDispatcher.on('hello', spy);

0 commit comments

Comments
 (0)