Skip to content

Instantly share code, notes, and snippets.

@goatslacker
Last active August 29, 2015 14:16
Show Gist options
  • Save goatslacker/a71c96f458ac3d3b5e47 to your computer and use it in GitHub Desktop.
Save goatslacker/a71c96f458ac3d3b5e47 to your computer and use it in GitHub Desktop.
var Alt = require('alt');
var alt = new Alt();
function Actions() { }
Actions.prototype.fetchSomething = function () {
return new Promise(function (resolve, reject) {
setTimeout(function () {
this.dispatch('value');
resolve('value');
}.bind(this), 100);
}.bind(this));
}
var actions = alt.createActions(Actions);
// not really fire and forget, but possible.
actions.fetchSomething().then(function (x) {
// do something with x?
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment