Created
March 27, 2015 19:06
-
-
Save goatslacker/6837de6e697909287ffe to your computer and use it in GitHub Desktop.
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
const Alt = require('./') | |
const Immutable = require('immutable') | |
const ImmutableUtil = require('./utils/ImmutableUtil') | |
const alt = new Alt() | |
const actions = alt.generateActions('fire') | |
const assign = require('object-assign') | |
//const store = alt.createStore(ImmutableUtil.makeImmutableStore({ | |
// displayName: 'ImmutableStore', | |
// | |
// bindListeners: { | |
// handleFoo: actions.fire | |
// }, | |
// | |
// lifecycle: { | |
// init: function () { | |
// console.log('This console log should fire') | |
// } | |
// }, | |
// | |
// handleFoo: function (x) { | |
// this.setState('foo', x) | |
// } | |
//})) | |
const store = alt.createStore(ImmutableUtil.makeImmutableStore(function Foo() { | |
this.foo = 'bar' | |
this.handleFoo = function (x) { | |
this.setState('foo', x) | |
} | |
this.bindListeners({ | |
handleFoo: actions.fire | |
}) | |
}), 'ImmutableStore') | |
actions.fire('hello') | |
console.log(store.getState().toJS().foo === 'hello') | |
console.log(JSON.parse(alt.takeSnapshot()).ImmutableStore.foo === 'hello') | |
var wtf = Immutable.Map({}) | |
console.log(wtf.toJS().foo === undefined) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment