Skip to content

Instantly share code, notes, and snippets.

@goatslacker
Created February 25, 2015 23:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save goatslacker/9399ed93e9e963fb2e42 to your computer and use it in GitHub Desktop.
Save goatslacker/9399ed93e9e963fb2e42 to your computer and use it in GitHub Desktop.
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