angular-inject
Version:
A JS decorator (@inject) for injecting dependencies inside your angular classes
1 lines • 1.12 kB
JavaScript
function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(t.__proto__=e)}function inject(t){return function(e){var r=function(e){function r(){_classCallCheck(this,r);for(var e=arguments.length,n=Array(e),o=0;e>o;o++)n[o]=arguments[o];_get(Object.getPrototypeOf(r.prototype),"constructor",this).apply(this,n);for(var i=0;i<t.length;i++)this[t[i]]=n[i]}return _inherits(r,e),r}(e);return r.$inject=t,r}}Object.defineProperty(exports,"__esModule",{value:!0});var _get=function(t,e,r){for(var n=!0;n;){var o=t,i=e,c=r;u=l=a=void 0,n=!1,null===o&&(o=Function.prototype);var u=Object.getOwnPropertyDescriptor(o,i);if(void 0!==u){if("value"in u)return u.value;var a=u.get;return void 0===a?void 0:a.call(c)}var l=Object.getPrototypeOf(o);if(null===l)return void 0;t=l,e=i,r=c,n=!0}};exports.inject=inject;
;