UNPKG

angular-session

Version:

67 lines (51 loc) 1.33 kB
/** * * * */ // require("../dependencies"); // angular .module("dependencies") .factory("$session", function() { // var $session = { // triggers: [], // internal: [], // set: function set(arg, val) { // this.internal[arg] = val; // if (typeof this.triggers[arg] === "undefined") { return; } // for (var i in this.triggers[arg]) { if (!this.triggers[arg].hasOwnProperty(i)) { continue; } var callback = this.triggers[arg][i]; callback(this.internal[arg]); } }, // got: function(arg, cb) { // if (typeof this.triggers[arg] === "undefined") { this.triggers[arg] = []; } // this.triggers[arg].push(cb); }, // get: function(arg) { return this.internal[arg]; }, // has: function(arg) { return typeof this.internal[arg] !== "undefined"; } }; // return $session; });