Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix some formatting and run the build #96

Merged
merged 1 commit into from
May 23, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions dist/delorean.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! delorean - v0.9.6-0 - 2015-08-24 */
/*! delorean - v0.9.8 - 2016-05-23 */
(function (DeLorean) {
'use strict';

Expand Down Expand Up @@ -99,7 +99,6 @@
DeLorean.EventEmitter.defaultMaxListeners = 50;
this.listener = new DeLorean.EventEmitter();
this.stores = stores;

/* Stores should be listened for rollback events. */
__rollbackListener(Object.keys(stores).map(function (key) {
return stores[key];
Expand Down Expand Up @@ -567,6 +566,17 @@

// ## Built-in React Mixin
DeLorean.Flux.mixins = {

// This mixin adds the this.trigger method to the component
// Components can then trigger actions in flux w/out watching stores and having their state
trigger: {
componentWillMount: function () {
this.__dispatcher = __findDispatcher(this);
},
trigger: function () {
this.__dispatcher.emit.apply(this.__dispatcher, arguments);
}
},
// It should be inserted to the React components which
// used in Flux.
// Simply `mixin: [Flux.mixins.storeListener]` will work.
Expand Down
2 changes: 1 addition & 1 deletion dist/delorean.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/delorean.min.js.map

Large diffs are not rendered by default.

5 changes: 0 additions & 5 deletions src/delorean.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@
DeLorean.EventEmitter.defaultMaxListeners = 50;
this.listener = new DeLorean.EventEmitter();
this.stores = stores;

/* Stores should be listened for rollback events. */
__rollbackListener(Object.keys(stores).map(function (key) {
return stores[key];
Expand Down Expand Up @@ -570,17 +569,13 @@
// This mixin adds the this.trigger method to the component
// Components can then trigger actions in flux w/out watching stores and having their state
trigger: {

componentWillMount: function () {
this.__dispatcher = __findDispatcher(this);
},

trigger: function () {
this.__dispatcher.emit.apply(this.__dispatcher, arguments);
}

},

// It should be inserted to the React components which
// used in Flux.
// Simply `mixin: [Flux.mixins.storeListener]` will work.
Expand Down
12 changes: 4 additions & 8 deletions test/spec/core/fluxSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,22 +95,18 @@ describe('Flux', function () {
});

it('should cleanup unused events after firing an action handler', function () {
MyAppDispatcher.dispatch('noChange', 'someText')
MyAppDispatcher.dispatch('noChange', 'someText')
MyAppDispatcher.dispatch('noChange', 'someText')
MyAppDispatcher.dispatch('noChange', 'someText')

MyAppDispatcher.dispatch('noChange', 'someText');
MyAppDispatcher.dispatch('noChange', 'someText');
MyAppDispatcher.dispatch('noChange', 'someText');
MyAppDispatcher.dispatch('noChange', 'someText');
changeListenerCount = myStore.listener.listeners('change').length;
rollbackListenerCount = myStore.listener.listeners('rollback').length;

// 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.
// however, without the cleanup, there would be 4 of each after 4 calls
expect(changeListenerCount).toEqual(1);
expect(rollbackListenerCount).toEqual(1);

});


it('dispatcher can listen events', function () {
var spy = jasmine.createSpy('dispatcher listener');
MyAppDispatcher.on('hello', spy);
Expand Down