Last active
August 29, 2015 14:16
-
-
Save goatslacker/0f709f4436ed4890945d 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
var Alt = require('./') | |
var alt = new Alt() | |
var actions = alt.generateActions('fire') | |
function MyStore() { | |
return { | |
displayName: 'MyStore', | |
state: { | |
data: 1 | |
}, | |
publicMethods: { | |
getData: function () { | |
return this.getState().data | |
} | |
}, | |
lifecycle: { | |
init: function () { | |
console.log('i was initialized') | |
} | |
}, | |
bindListeners: { | |
handleFire: actions.FIRE | |
}, | |
handleFire: function (data) { | |
// console.log('@', this) | |
this.state.data = data | |
} | |
} | |
} | |
var store = alt.createStore(MyStore()) | |
//console.log('@', store.getEventEmitter, store.getState) | |
console.log(1, store.getData()) | |
actions.fire(2) | |
console.log(2, store.getState()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment