Comparing version 0.2.2 to 0.2.3
{ | ||
"name": "reflux", | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"homepage": "https://github.com/spoike/reflux", | ||
@@ -5,0 +5,0 @@ "authors": [ |
@@ -5,2 +5,13 @@ # Changelog | ||
## v0.2.3 | ||
* Store mixins [#124](https://github.com/spoike/refluxjs/pull/124) | ||
## v0.2.2 | ||
* Fixed circular dependency issue that caused browserify builds not to work as expected [#129](https://github.com/spoike/refluxjs/issues/129) [#138](https://github.com/spoike/refluxjs/issues/138) | ||
* Bind store methods before init() method executes. [#168](https://github.com/spoike/refluxjs/issues/168) | ||
* Clarify the meaning of "FRP". [#161](https://github.com/spoike/refluxjs/issues/161) | ||
* Child (async) actions and promise handling [#140](https://github.com/spoike/refluxjs/issues/140) | ||
## v0.2.1 | ||
@@ -7,0 +18,0 @@ |
{ | ||
"name": "reflux", | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"description": "A simple library for uni-directional dataflow application architecture inspired by ReactJS Flux", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -255,2 +255,29 @@ # RefluxJS | ||
#### Mixins in stores | ||
Just as you can add mixins to React components, so it is possible to add your mixins to Store. | ||
```javascript | ||
var MyMixin = { foo: function() { console.log('bar!'); } } | ||
var Store = Reflux.createStore({ | ||
mixins: [MyMixin] | ||
}); | ||
Store.foo(); // outputs "bar!" to console | ||
``` | ||
Methods from mixins is available as well as the methods declared in the Store. So it's possible to access store's `this` from mixin, or methods of mixin from methods of store: | ||
```javascript | ||
var MyMixin = { mixinMethod: function() { console.log(this.foo); } } | ||
var Store = Reflux.createStore({ | ||
mixins: [MyMixin], | ||
foo: 'bar!', | ||
storeMethod: function() { | ||
this.mixinMethod(); // outputs "bar!" to console | ||
} | ||
}); | ||
``` | ||
A nice feature of mixins is that if a store is using multiple mixins and several mixins define the same lifecycle method (e.g. `init`, `preEmit`, `shouldEmit`), all of the lifecycle methods are guaranteed to be called. | ||
#### Listening to many actions at once | ||
@@ -257,0 +284,0 @@ |
var _ = require('./utils'), | ||
Reflux = require('./index'), | ||
Keep = require('./Keep'), | ||
mixer = require('./mixer'), | ||
allowed = {preEmit:1,shouldEmit:1}, | ||
@@ -35,2 +36,4 @@ bindMethods = require('./bindMethods'); | ||
definition = mixer(definition); | ||
function Store() { | ||
@@ -37,0 +40,0 @@ var i=0, arr; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
63562
28
897
607