jpex-web
Version:
Jpex defaults for web
1 lines • 6.62 kB
JavaScript
!function(){var e=[];e[1]=function(e,n,t){n.exports=function(e){return e.document}},e[2]=function(e,n,t){n.exports=function(){return window}},e[4]=function(e,n,t){!function(e){function t(){}function o(e,n){return function(){e.apply(n,arguments)}}function r(e){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof e)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],l(e,this)}function i(e,n){for(;3===e._state;)e=e._value;if(0===e._state)return void e._deferreds.push(n);e._handled=!0,r._immediateFn(function(){var t=1===e._state?n.onFulfilled:n.onRejected;if(null===t)return void(1===e._state?c:u)(n.promise,e._value);var o;try{o=t(e._value)}catch(e){return void u(n.promise,e)}c(n.promise,o)})}function c(e,n){try{if(n===e)throw new TypeError("A promise cannot be resolved with itself.");if(n&&("object"==typeof n||"function"==typeof n)){var t=n.then;if(n instanceof r)return e._state=3,e._value=n,void f(e);if("function"==typeof t)return void l(o(t,n),e)}e._state=1,e._value=n,f(e)}catch(n){u(e,n)}}function u(e,n){e._state=2,e._value=n,f(e)}function f(e){2===e._state&&0===e._deferreds.length&&r._immediateFn(function(){e._handled||r._unhandledRejectionFn(e._value)});for(var n=0,t=e._deferreds.length;n<t;n++)i(e,e._deferreds[n]);e._deferreds=null}function a(e,n,t){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof n?n:null,this.promise=t}function l(e,n){var t=!1;try{e(function(e){t||(t=!0,c(n,e))},function(e){t||(t=!0,u(n,e))})}catch(e){if(t)return;t=!0,u(n,e)}}var s=setTimeout;r.prototype.catch=function(e){return this.then(null,e)},r.prototype.then=function(e,n){var o=new this.constructor(t);return i(this,new a(e,n,o)),o},r.all=function(e){var n=Array.prototype.slice.call(e);return new r(function(e,t){function o(i,c){try{if(c&&("object"==typeof c||"function"==typeof c)){var u=c.then;if("function"==typeof u)return void u.call(c,function(e){o(i,e)},t)}n[i]=c,0==--r&&e(n)}catch(e){t(e)}}if(0===n.length)return e([]);for(var r=n.length,i=0;i<n.length;i++)o(i,n[i])})},r.resolve=function(e){return e&&"object"==typeof e&&e.constructor===r?e:new r(function(n){n(e)})},r.reject=function(e){return new r(function(n,t){t(e)})},r.race=function(e){return new r(function(n,t){for(var o=0,r=e.length;o<r;o++)e[o].then(n,t)})},r._immediateFn="function"==typeof setImmediate&&function(e){setImmediate(e)}||function(e){s(e,0)},r._unhandledRejectionFn=function(e){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",e)},r._setImmediateFn=function(e){r._immediateFn=e},r._setUnhandledRejectionFn=function(e){r._unhandledRejectionFn=e},void 0!==n&&n.exports?n.exports=r:e.Promise||(e.Promise=r)}(this)},e[3]=function(e,n,t){n.exports=function(){return"undefined"!=typeof Promise?Promise:e(4)}},e[6]=function(e,n,t){n.exports=function(e){var n,t=function(e,n){for(var t=0,o=n.length;t<o;t++)if(n[t].from===e)return e},o=function(r,i,c,u){switch(u=u||[],e(r)){case"string":case"number":case"boolean":case"function":case"null":case"undefined":return r;case"date":return new Date(r);case"regexp":var f=[];return r.global&&f.push("g"),r.ignoreCase&&f.push("i"),new RegExp(r.source,f.join(""));case"array":return n=t(r,u),n?n.to:(i=[],u.push({from:r,to:i}),r.forEach(function(e){i.push(c?o(e,void 0,!0,u):e)}),i);case"object":return(n=t(r,u))?n.to:(i=i||{},u.push({from:r,to:i}),Object.keys(r).forEach(function(e){i[e]=c?o(r[e],i[e],c,u):r[e]}),i);default:throw new Error("Unexpected type: "+e(r))}},r=function(e){return r.shallow(e)};return r.shallow=function(e){return o(e)},r.deep=function(e){return o(e,null,!0)},r.extend=function(){var e=Array.prototype.slice.call(arguments),n=e.shift();return e.forEach(function(e){o(e,n,!0)}),n},r}},e[7]=function(e,n,t){n.exports=function(){var e=function(){return e.log.apply(null,arguments)};return e.log=function(){return console.log.apply(null,arguments)},e.info=function(){return console.info.apply(null,arguments)},e.warn=function(){return console.warn.apply(null,arguments)},e.error=function(){return console.error.apply(null,arguments)},e}},e[8]=function(e,n,t){n.exports=function(){return Promise}},e[9]=function(e,n,t){n.exports=function(e){var n=function(n){return new e(n)};return n.all=e.all.bind(e),n.race=e.race.bind(e),n.reject=e.reject.bind(e),n.resolve=e.resolve.bind(e),n}},e[10]=function(e,n,t){n.exports=function(){function e(e,n){return setTimeout(e,n)}return e.clear=function(e){return clearTimeout(e)},e}},e[11]=function(e,n,t){n.exports=function(){function e(e,n){return setInterval(e,n)}return e.clear=function(e){return clearInterval(e)},e}},e[12]=function(e,n,t){n.exports=function(e){function n(n){return t?setImmediate(n):e(n,0)}var t="function"==typeof setImmediate;return n.clear=function(n){return t?clearImmediate(n):e.clear(n)},n}},e[13]=function(e,n,t){n.exports=function(){var e=["number","boolean","string","array","function","date","regexp","null","undefined"];return function(n,t){var o=Object.prototype.toString.call(n).match(/\s([a-zA-Z]+)/)[1].toLowerCase();return!t&&e.indexOf(o)<0?"object":o}}},e[5]=function(e,n,t){var o=e(6),r=e(7),i=e(8),c=e(9),u=e(10),f=e(11),a=e(12),l=e(13);t.name="jpex-defaults",t.silent=!0,t.install=function(e){var n=e.Jpex;n.register.factory("$copy",["$typeof"],o).lifecycle.application(),n.register.factory("$log",[],r).lifecycle.application(),n.register.factory("$$promise",[],i).lifecycle.application(),n.register.factory("$promise",["$$promise"],c).lifecycle.application(),n.register.factory("$timeout",[],u).lifecycle.application(),n.register.factory("$interval",[],f).lifecycle.application(),n.register.factory("$immediate",["$timeout"],a).lifecycle.application(),n.register.factory("$typeof",[],l).lifecycle.application()},"undefined"!=typeof window&&window.Jpex&&"function"==typeof window.Jpex.use&&window.Jpex.use(t)},e[0]=function(e,n,t){var o=e(1),r=e(2),i=e(3);t.name="jpex-web",t.install=function(n){var t=n.Jpex;if(!t.$$factories.$promise){var c=e(5);t.use(c)}t.register.factory("$document","$window",o).lifecycle.application(),t.register.factory("$window",[],r).lifecycle.application(),t.register.factory("$$promise",[],i)},"undefined"!=typeof window&&window.Jpex&&"function"==typeof window.Jpex.use&&window.Jpex.use(t)};var n=function(t){if(n.cache[t])return n.cache[t];var o={exports:{}},r=e[t];if(!r)throw new Error("Could not find module "+t);return r(n,o,o.exports),n.cache[t]=o.exports,o.exports};n.cache=[],"undefined"!=typeof module?module.exports=n(0):"undefined"!=typeof window&&(window.jpexWeb=n(0))}();