-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Quick ES6 rewrite - More documentation, logo
- Loading branch information
Alexandre Galays
committed
Aug 6, 2015
1 parent
11a7f50
commit ac6db3d
Showing
17 changed files
with
201 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,15 @@ | ||
import ActorStore from '../../src/ActorStore'; | ||
import Store from '../../src/Store'; | ||
import { init, decrement, increment } from './actions'; | ||
import blueNumber from './blueNumber'; | ||
|
||
|
||
// Here, ActorStore is used to compute a derived state; A stateless Store wouldn't do the job. | ||
module.exports = ActorStore(function greenNumber(on) { | ||
var currentOffset = 0; | ||
export default Store({ | ||
name: 'green', | ||
|
||
on(init); | ||
on(decrement, offset => currentOffset -= (10 * offset)); | ||
on(increment, offset => currentOffset += (10 * offset)); | ||
state: 0, | ||
|
||
return { | ||
value: function() { return blueNumber.state + currentOffset } | ||
}; | ||
handlers: { | ||
[init]: (state, val) => val, | ||
[increment]: (state, offset) => state + 10 * offset, | ||
[decrement]: (state, offset) => state - 10 * offset | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,25 @@ | ||
import React from 'react'; | ||
import fluxx from '../../src/fluxx'; | ||
import blueNumber from './blueNumber'; | ||
import greenNumber from './greenNumber'; | ||
import redNumber from './redNumber'; | ||
import Fluxx from '../../src/addon/ReactConnector'; | ||
import blueStore from './blueNumber'; | ||
import greenStore from './greenNumber'; | ||
import redStore from './redNumber'; | ||
import App from './App'; | ||
import { init } from './actions'; | ||
|
||
|
||
function render() { | ||
console.log('render'); | ||
|
||
return React.render( | ||
React.render( | ||
<Fluxx stores={[blueStore, greenStore, redStore]}>{ (blue, green, red) => | ||
<App | ||
blueNumber={blueNumber.state} | ||
greenNumber={greenNumber.value()} | ||
redNumber={redNumber.state}/>, | ||
blueNumber={blue} | ||
greenNumber={green} | ||
redNumber={red}/> | ||
} | ||
</Fluxx>, | ||
|
||
document.querySelector('body') | ||
); | ||
} | ||
document.querySelector('body') | ||
); | ||
|
||
fluxx.onChange(blueNumber, greenNumber, redNumber)(render); | ||
|
||
fluxx.enableLogs(); | ||
init(10); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.