Commit ecedcd3e by TingSong-Syu

neo-call-native-1.1.2

parent d15b5792
!function(t){function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}var e={};n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:r})},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},n.p="",n(n.s=2)}([function(t,n,e){"use strict";function r(){}function o(t){try{return t.then}catch(t){return g=t,_}}function i(t,n){try{return t(n)}catch(t){return g=t,_}}function u(t,n,e){try{t(n,e)}catch(t){return g=t,_}}function c(t){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof t)throw new TypeError("Promise constructor's argument is not a function");this._75=0,this._83=0,this._18=null,this._38=null,t!==r&&y(t,this)}function s(t,n,e){return new t.constructor(function(o,i){var u=new c(r);u.then(o,i),f(t,new d(n,e,u))})}function f(t,n){for(;3===t._83;)t=t._18;if(c._47&&c._47(t),0===t._83)return 0===t._75?(t._75=1,void(t._38=n)):1===t._75?(t._75=2,void(t._38=[t._38,n])):void t._38.push(n);a(t,n)}function a(t,n){v(function(){var e=1===t._83?n.onFulfilled:n.onRejected;if(null===e)return void(1===t._83?l(n.promise,t._18):p(n.promise,t._18));var r=i(e,t._18);r===_?p(n.promise,g):l(n.promise,r)})}function l(t,n){if(n===t)return p(t,new TypeError("A promise cannot be resolved with itself."));if(n&&("object"==typeof n||"function"==typeof n)){var e=o(n);if(e===_)return p(t,g);if(e===t.then&&n instanceof c)return t._83=3,t._18=n,void h(t);if("function"==typeof e)return void y(e.bind(n),t)}t._83=1,t._18=n,h(t)}function p(t,n){t._83=2,t._18=n,c._71&&c._71(t,n),h(t)}function h(t){if(1===t._75&&(f(t,t._38),t._38=null),2===t._75){for(var n=0;n<t._38.length;n++)f(t,t._38[n]);t._38=null}}function d(t,n,e){this.onFulfilled="function"==typeof t?t:null,this.onRejected="function"==typeof n?n:null,this.promise=e}function y(t,n){var e=!1,r=u(t,function(t){e||(e=!0,l(n,t))},function(t){e||(e=!0,p(n,t))});e||r!==_||(e=!0,p(n,g))}var v=e(1),g=null,_={};t.exports=c,c._47=null,c._71=null,c._44=r,c.prototype.then=function(t,n){if(this.constructor!==c)return s(this,t,n);var e=new c(r);return f(this,new d(t,n,e)),e}},function(t,n,e){"use strict";(function(n){function e(t){u.length||(i(),c=!0),u[u.length]=t}function r(){for(;s<u.length;){var t=s;if(s+=1,u[t].call(),s>f){for(var n=0,e=u.length-s;n<e;n++)u[n]=u[n+s];u.length-=s,s=0}}u.length=0,s=0,c=!1}function o(t){return function(){function n(){clearTimeout(e),clearInterval(r),t()}var e=setTimeout(n,0),r=setInterval(n,50)}}t.exports=e;var i,u=[],c=!1,s=0,f=1024,a=void 0!==n?n:self,l=a.MutationObserver||a.WebKitMutationObserver;i="function"==typeof l?function(t){var n=1,e=new l(t),r=document.createTextNode("");return e.observe(r,{characterData:!0}),function(){n=-n,r.data=n}}(r):o(r),e.requestFlush=i,e.makeRequestCallFromTimer=o}).call(n,e(5))},function(module,exports,__webpack_require__){"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Promise=__webpack_require__(3);"object"!==_typeof(window.neo)&&(window.neo={}),"object"!==_typeof(window.neo.skapp)&&(window.neo.skapp={delegates:{}});var neo=window.neo,skapp=window.neo.skapp,callNative=function callNative(o){var msg=JSON.stringify(o);if(console.log(msg),navigator.userAgent.match(/iPad/i)||navigator.userAgent.match(/iPhone/i)||navigator.userAgent.match(/iPod/i)||navigator.userAgent.match(/iOS/i))window.webkit.messageHandlers.app.postMessage(msg);else{if(!navigator.userAgent.match(/Android/i))throw console.error("Only SKAPP is supported"),"Only SKAPP is supported";var r=AndroidApp.callNative(msg);r&&eval(o.ok+"("+r+")")}},randStr=function t(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";return n>0?e[Math.floor(Math.random()*e.length)]+t(n-1,e):""};skapp.callVoid=function(t){for(var n=arguments.length,e=Array(n>1?n-1:0),r=1;r<n;r++)e[r-1]=arguments[r];callNative({func:t,args:e,ok:"",err:""})},skapp.callAsync=function(t){for(var n=arguments.length,e=Array(n>1?n-1:0),r=1;r<n;r++)e[r-1]=arguments[r];return new Promise(function(n,r){var o="ok"+randStr(5),i="err"+randStr(5),u=function(){setTimeout(function(){delete skapp.delegates[o],delete skapp.delegates[i]},10)};skapp.delegates[o]=function(t){u(),n(t)},skapp.delegates[i]=function(t){u(),r(t)};try{callNative({func:t,args:e,ok:"neo.skapp.delegates."+o,err:"neo.skapp.delegates."+i})}catch(t){r(t)}})},skapp.dial=function(t){skapp.callVoid("dial",t||"")},skapp.setTitle=function(t){"string"!=typeof t&&(t=t.toString()),skapp.callVoid("setTitle",t)},skapp.getUser=function(){return skapp.callAsync("getUser")},skapp.gotoSjdct=function(){skapp.callVoid("gotoSjdct")},document.documentElement.addEventListener("DOMSubtreeModified",function(t){"title"===t.target.tagName.toLowerCase()&&neo.skapp.setTitle(t.target.innerText)}),module.exports=neo},function(t,n,e){"use strict";t.exports=e(4)},function(t,n,e){"use strict";t.exports=e(0),e(6),e(7),e(8),e(9),e(11)},function(t,n){var e;e=function(){return this}();try{e=e||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(e=window)}t.exports=e},function(t,n,e){"use strict";var r=e(0);t.exports=r,r.prototype.done=function(t,n){(arguments.length?this.then.apply(this,arguments):this).then(null,function(t){setTimeout(function(){throw t},0)})}},function(t,n,e){"use strict";var r=e(0);t.exports=r,r.prototype.finally=function(t){return this.then(function(n){return r.resolve(t()).then(function(){return n})},function(n){return r.resolve(t()).then(function(){throw n})})}},function(t,n,e){"use strict";function r(t){var n=new o(o._44);return n._83=1,n._18=t,n}var o=e(0);t.exports=o;var i=r(!0),u=r(!1),c=r(null),s=r(void 0),f=r(0),a=r("");o.resolve=function(t){if(t instanceof o)return t;if(null===t)return c;if(void 0===t)return s;if(!0===t)return i;if(!1===t)return u;if(0===t)return f;if(""===t)return a;if("object"==typeof t||"function"==typeof t)try{var n=t.then;if("function"==typeof n)return new o(n.bind(t))}catch(t){return new o(function(n,e){e(t)})}return r(t)},o.all=function(t){var n=Array.prototype.slice.call(t);return new o(function(t,e){function r(u,c){if(c&&("object"==typeof c||"function"==typeof c)){if(c instanceof o&&c.then===o.prototype.then){for(;3===c._83;)c=c._18;return 1===c._83?r(u,c._18):(2===c._83&&e(c._18),void c.then(function(t){r(u,t)},e))}var s=c.then;if("function"==typeof s){return void new o(s.bind(c)).then(function(t){r(u,t)},e)}}n[u]=c,0==--i&&t(n)}if(0===n.length)return t([]);for(var i=n.length,u=0;u<n.length;u++)r(u,n[u])})},o.reject=function(t){return new o(function(n,e){e(t)})},o.race=function(t){return new o(function(n,e){t.forEach(function(t){o.resolve(t).then(n,e)})})},o.prototype.catch=function(t){return this.then(null,t)}},function(t,n,e){"use strict";function r(t,n){for(var e=[],r=0;r<n;r++)e.push("a"+r);var o=["return function ("+e.join(",")+") {","var self = this;","return new Promise(function (rs, rj) {","var res = fn.call(",["self"].concat(e).concat([c]).join(","),");","if (res &&",'(typeof res === "object" || typeof res === "function") &&','typeof res.then === "function"',") {rs(res);}","});","};"].join("");return Function(["Promise","fn"],o)(i,t)}function o(t){for(var n=Math.max(t.length-1,3),e=[],r=0;r<n;r++)e.push("a"+r);var o=["return function ("+e.join(",")+") {","var self = this;","var args;","var argLength = arguments.length;","if (arguments.length > "+n+") {","args = new Array(arguments.length + 1);","for (var i = 0; i < arguments.length; i++) {","args[i] = arguments[i];","}","}","return new Promise(function (rs, rj) {","var cb = "+c+";","var res;","switch (argLength) {",e.concat(["extra"]).map(function(t,n){return"case "+n+":res = fn.call("+["self"].concat(e.slice(0,n)).concat("cb").join(",")+");break;"}).join(""),"default:","args[argLength] = cb;","res = fn.apply(self, args);","}","if (res &&",'(typeof res === "object" || typeof res === "function") &&','typeof res.then === "function"',") {rs(res);}","});","};"].join("");return Function(["Promise","fn"],o)(i,t)}var i=e(0),u=e(10);t.exports=i,i.denodeify=function(t,n){return"number"==typeof n&&n!==1/0?r(t,n):o(t)};var c="function (err, res) {if (err) { rj(err); } else { rs(res); }}";i.nodeify=function(t){return function(){var n=Array.prototype.slice.call(arguments),e="function"==typeof n[n.length-1]?n.pop():null,r=this;try{return t.apply(this,arguments).nodeify(e,r)}catch(t){if(null===e||void 0===e)return new i(function(n,e){e(t)});u(function(){e.call(r,t)})}}},i.prototype.nodeify=function(t,n){if("function"!=typeof t)return this;this.then(function(e){u(function(){t.call(n,null,e)})},function(e){u(function(){t.call(n,e)})})}},function(t,n,e){"use strict";function r(){if(s.length)throw s.shift()}function o(t){var n;n=c.length?c.pop():new i,n.task=t,u(n)}function i(){this.task=null}var u=e(1),c=[],s=[],f=u.makeRequestCallFromTimer(r);t.exports=o,i.prototype.call=function(){try{this.task.call()}catch(t){o.onerror?o.onerror(t):(s.push(t),f())}finally{this.task=null,c[c.length]=this}}},function(t,n,e){"use strict";var r=e(0);t.exports=r,r.enableSynchronous=function(){r.prototype.isPending=function(){return 0==this.getState()},r.prototype.isFulfilled=function(){return 1==this.getState()},r.prototype.isRejected=function(){return 2==this.getState()},r.prototype.getValue=function(){if(3===this._83)return this._18.getValue();if(!this.isFulfilled())throw new Error("Cannot get a value of an unfulfilled promise.");return this._18},r.prototype.getReason=function(){if(3===this._83)return this._18.getReason();if(!this.isRejected())throw new Error("Cannot get a rejection reason of a non-rejected promise.");return this._18},r.prototype.getState=function(){return 3===this._83?this._18.getState():-1===this._83||-2===this._83?0:this._83}},r.disableSynchronous=function(){r.prototype.isPending=void 0,r.prototype.isFulfilled=void 0,r.prototype.isRejected=void 0,r.prototype.getValue=void 0,r.prototype.getReason=void 0,r.prototype.getState=void 0}}]);
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment