Created
February 25, 2015 23:08
-
-
Save goatslacker/9399ed93e9e963fb2e42 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
import Alt from 'alt'; | |
import DispatcherRecorder from 'alt/utils/DispatcherRecorder'; | |
let alt = new Alt(); | |
let recorder = new DispatcherRecorder(alt); | |
// setup actions and store | |
function Actions() { this.generateActions('a', 'b', 'c'); } | |
let actions = alt.createActions(Actions) | |
class Store { | |
constructor() { | |
this.bindActions(actions); | |
this.a = 0; | |
this.b = 0; | |
this.c = 0; | |
} | |
a(value) { this.a = value; } | |
b(value) { this.b = value; } | |
c(value) { this.c = value; } | |
} | |
let store = alt.createStore(Store); | |
// start recording | |
recorder.record(); | |
actions.a('hello'); | |
actions.b('world'); | |
actions.c('it works'); | |
recorder.stop(); | |
recorder.replay(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment