Comparing version 0.3.7 to 0.3.9
20
index.js
@@ -20,3 +20,3 @@ /* Fluxury - Copyright 2015 Peter W Moresi */ | ||
/* transform a list of actions into useful functions */ | ||
/* transform a list of actions into key-mirrored object */ | ||
createActions: function(...actions) { | ||
@@ -40,14 +40,12 @@ return Object.freeze(actions.reduce(function(a,b) { | ||
var dispatchToken = dispatcher.register( function(action) { | ||
dispatcher.waitFor(waitFor); | ||
var newState = reducer(currentState, action); | ||
if (currentState !== newState) { | ||
currentState = Object.freeze(newState); | ||
emitter.emit(changedEvent); | ||
} | ||
}); | ||
return Object.freeze({ | ||
name: name, | ||
dispatchToken: dispatchToken, | ||
dispatchToken: dispatcher.register( function(action) { | ||
dispatcher.waitFor(waitFor); | ||
var newState = reducer(currentState, action); | ||
if (currentState !== newState) { | ||
currentState = Object.freeze(newState); | ||
emitter.emit(changedEvent); | ||
} | ||
} ), | ||
addListener: function(cb) { | ||
@@ -54,0 +52,0 @@ return emitter.addListener(changedEvent, cb) |
@@ -28,3 +28,3 @@ /* Fluxury - Copyright 2015 Peter W Moresi */ | ||
/* transform a list of actions into useful functions */ | ||
/* transform a list of actions into key-mirrored object */ | ||
createActions: function createActions() { | ||
@@ -55,14 +55,12 @@ for (var _len = arguments.length, actions = Array(_len), _key = 0; _key < _len; _key++) { | ||
var dispatchToken = dispatcher.register(function (action) { | ||
dispatcher.waitFor(waitFor); | ||
var newState = reducer(currentState, action); | ||
if (currentState !== newState) { | ||
currentState = Object.freeze(newState); | ||
emitter.emit(changedEvent); | ||
} | ||
}); | ||
return Object.freeze({ | ||
name: name, | ||
dispatchToken: dispatchToken, | ||
dispatchToken: dispatcher.register(function (action) { | ||
dispatcher.waitFor(waitFor); | ||
var newState = reducer(currentState, action); | ||
if (currentState !== newState) { | ||
currentState = Object.freeze(newState); | ||
emitter.emit(changedEvent); | ||
} | ||
}), | ||
addListener: function addListener(cb) { | ||
@@ -69,0 +67,0 @@ return emitter.addListener(changedEvent, cb); |
{ | ||
"name": "fluxury", | ||
"version": "0.3.7", | ||
"version": "0.3.9", | ||
"description": "Add luxury sugar to simplify implementing Facebook's flavor of Flux architecture.", | ||
@@ -20,3 +20,16 @@ "main": "./lib/index.js", | ||
"tape": "^4.2.2" | ||
} | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/fluxury/fluxury.git" | ||
}, | ||
"keywords": [ | ||
"react", | ||
"react-component", | ||
"flux" | ||
], | ||
"bugs": { | ||
"url": "https://github.com/fluxury/fluxury/issues" | ||
}, | ||
"homepage": "https://github.com/fluxury/fluxury#readme" | ||
} |
@@ -29,3 +29,3 @@ # fluxury | ||
Don't be afraid to read the code. It is sparse 70 lines of ES 2015 code. | ||
Don't be afraid to read the code. It is only 69 lines! | ||
@@ -36,3 +36,3 @@ Pull requests welcome. Enjoy! | ||
1. dispatch( type, data ) | ||
1. dispatch( type, data ) or dispatch( action ) | ||
@@ -44,5 +44,8 @@ Submit an action into the stores. You must specify the type and, optionally, some data. | ||
dispatch('REQUEST_SETTINGS') | ||
// dispatch an action with a string | ||
dispatch('REQUEST_SETTINGS') // => { type: 'LOAD_SETTINGS', data: undefined } | ||
// or with data | ||
dispatch('LOAD_SETTINGS', { a: 1, b: 2 }) | ||
dispatch('LOAD_SETTINGS', { a: 1, b: 2 }) // => { type: 'LOAD_SETTINGS', data: { a: 1, b: 2 } } | ||
// or with a custom object | ||
dispatch({ actionType: 'move', mode: 'off the rails' }) | ||
``` | ||
@@ -161,3 +164,5 @@ | ||
var {INC, DEC} = createActions('INC', 'DEC'); | ||
var PureRenderMixin = require('react-addons-pure-render-mixin'); | ||
var countStore = createStore('CountStore', 0, function(state, action) { | ||
@@ -176,2 +181,4 @@ switch (action.type) { | ||
mixins: [PureRenderMixin], | ||
componentDidMount: function() { | ||
@@ -178,0 +185,0 @@ this.token = countStore.addListener( this.handleStoreChange ); |
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
17867
1
1
283
0
231