forked from h2non/angular-resilient
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathangular-resilient.min.js
3 lines (3 loc) · 1.41 KB
/
angular-resilient.min.js
1
2
3
/*! angular-resilient - v0.3.0 - MIT License - https://github.com/h2non/angular-resilient */
angular.module("ngResilient",[]).constant("$$resilient",window.resilient).config(["$$resilient",function(e){if(typeof e!=="function"){throw new Error("resilient.js is not available in the global scope")}}]).factory("$resilient",["$http","$$resilient","$ResilientProxy",function(e,n,t){function r(n,t){e(n).then(function(e){t(null,i(e))}).catch(function(e){t(i(e))})}function i(e){if(e&&typeof e.headers==="function"){e.$$headers=e.headers;e.headers=e.headers()}return e}function u(e){var i=n(e);i.useHttpClient(r);return t(i)}return u}]).factory("$ResilientProxy",["$q",function(e){function n(n){function t(e){return function(n,t){if(n)e.reject(r(n));else e.resolve(r(t))}}function r(e){if(e&&typeof e.$$headers==="function"){e.headers=e.$$headers;e.$$headers=undefined}return e}function i(r){var i=e.defer();n.send(r,t(i));return i.promise}function u(e,n){if(angular.isObject(e)){n=e}else{n=angular.isObject(n)?n:{};n.path=e}return n}function o(e){return function(n,t){t=u(n,t);t.method=e;return s(t)}}function s(e,n){return i(u(e,n))}s.resilient=n;s.defaults=n.defaults;s.VERSION=n.VERSION;s.get=o("GET");s.post=o("POST");s.put=o("PUT");s.delete=o("DELETE");s.patch=o("PATCH");s.head=o("HEAD");s.use=angular.bind(n,n.use);return s}return n}]);
//# sourceMappingURL=http://cdn.rawgit.com/h2non/angular-resilient/0.3.0/angular-resilient.min.js.map