mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-31 11:40:47 +08:00
Added test
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
/// <reference path="reflux.d.ts" />
|
||||
|
||||
|
||||
var Reflux: RefluxCore;
|
||||
|
||||
var syncActions = Reflux.createActions([
|
||||
"statusUpdate",
|
||||
"statusEdited",
|
||||
"statusAdded"
|
||||
]);
|
||||
|
||||
|
||||
var asyncActions = Reflux.createActions({
|
||||
fireBall: {asyncResult: true}
|
||||
});
|
||||
|
||||
asyncActions.fireBall.listen(function () {
|
||||
// Trigger async action
|
||||
setTimeout(() => this.completed(true), 1000);
|
||||
});
|
||||
|
||||
|
||||
// Creates a DataStore
|
||||
var statusStore = Reflux.createStore({
|
||||
|
||||
// Initial setup
|
||||
init: function () {
|
||||
|
||||
// Register statusUpdate action
|
||||
this.listenTo(asyncActions.fireBall, this.onFireBall);
|
||||
},
|
||||
// Callback
|
||||
onFireBall: function (flag) {
|
||||
var status = flag ? 'ONLINE' : 'OFFLINE';
|
||||
|
||||
// Pass on to listeners
|
||||
this.trigger(status);
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user