Skip to content

Instantly share code, notes, and snippets.

@MagnusThor
Created November 27, 2015 11:04
Show Gist options
  • Save MagnusThor/8d8a9430f18a3bbcfe43 to your computer and use it in GitHub Desktop.
Save MagnusThor/8d8a9430f18a3bbcfe43 to your computer and use it in GitHub Desktop.
Just a thing
angular.module("myApp").factory("await", [
function() {
this.awaits = {};
this.await = function (what, fn) {
this.awaits[what] = fn;
return this;
};
this.fire = function (what, data) {
if (this.awaits.hasOwnProperty(what)) {
this.awaits[what].apply(this,[data]);
}
};
return this;
}
]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment