UNPKG

@nota/nativescript-webview-ext

Version:

Extended WebView for NativeScript which adds 'x-local' scheme for local-files. events between WebView and native-layer, javascript execution, injecting CSS and JS-files.

1 lines 3.27 kB
(function(e,n){typeof exports==="object"&&typeof module!=="undefined"?n():typeof define==="function"&&define.amd?define(n):n()})(this,function(){"use strict";function e(n){var t=this.constructor;return this.then(function(e){return t.resolve(n()).then(function(){return e})},function(e){return t.resolve(n()).then(function(){return t.reject(e)})})}var n=setTimeout;function r(){}function o(e,n){return function(){e.apply(n,arguments)}}function i(e){if(!(this instanceof i))throw new TypeError("Promises must be constructed via new");if(typeof e!=="function")throw new TypeError("not a function");this._state=0;this._handled=false;this._value=undefined;this._deferreds=[];s(e,this)}function f(t,r){while(t._state===3){t=t._value}if(t._state===0){t._deferreds.push(r);return}t._handled=true;i._immediateFn(function(){var e=t._state===1?r.onFulfilled:r.onRejected;if(e===null){(t._state===1?u:c)(r.promise,t._value);return}var n;try{n=e(t._value)}catch(e){c(r.promise,e);return}u(r.promise,n)})}function u(n,e){try{if(e===n)throw new TypeError("A promise cannot be resolved with itself.");if(e&&(typeof e==="object"||typeof e==="function")){var t=e.then;if(e instanceof i){n._state=3;n._value=e;l(n);return}else if(typeof t==="function"){s(o(t,e),n);return}}n._state=1;n._value=e;l(n)}catch(e){c(n,e)}}function c(e,n){e._state=2;e._value=n;l(e)}function l(e){if(e._state===2&&e._deferreds.length===0){i._immediateFn(function(){if(!e._handled){i._unhandledRejectionFn(e._value)}})}for(var n=0,t=e._deferreds.length;n<t;n++){f(e,e._deferreds[n])}e._deferreds=null}function a(e,n,t){this.onFulfilled=typeof e==="function"?e:null;this.onRejected=typeof n==="function"?n:null;this.promise=t}function s(e,n){var t=false;try{e(function(e){if(t)return;t=true;u(n,e)},function(e){if(t)return;t=true;c(n,e)})}catch(e){if(t)return;t=true;c(n,e)}}i.prototype["catch"]=function(e){return this.then(null,e)};i.prototype.then=function(e,n){var t=new this.constructor(r);f(this,new a(e,n,t));return t};i.prototype["finally"]=e;i.all=function(n){return new i(function(r,o){if(!n||typeof n.length==="undefined")throw new TypeError("Promise.all accepts an array");var i=Array.prototype.slice.call(n);if(i.length===0)return r([]);var f=i.length;function u(n,e){try{if(e&&(typeof e==="object"||typeof e==="function")){var t=e.then;if(typeof t==="function"){t.call(e,function(e){u(n,e)},o);return}}i[n]=e;if(--f===0){r(i)}}catch(e){o(e)}}for(var e=0;e<i.length;e++){u(e,i[e])}})};i.resolve=function(n){if(n&&typeof n==="object"&&n.constructor===i){return n}return new i(function(e){e(n)})};i.reject=function(t){return new i(function(e,n){n(t)})};i.race=function(o){return new i(function(e,n){for(var t=0,r=o.length;t<r;t++){o[t].then(e,n)}})};i._immediateFn=typeof setImmediate==="function"&&function(e){setImmediate(e)}||function(e){n(e,0)};i._unhandledRejectionFn=function e(n){if(typeof console!=="undefined"&&console){console.warn("Possible Unhandled Promise Rejection:",n)}};var t=function(){if(typeof self!=="undefined"){return self}if(typeof window!=="undefined"){return window}if(typeof global!=="undefined"){return global}throw new Error("unable to locate global object")}();if(!("Promise"in t)){t["Promise"]=i}else if(!t.Promise.prototype["finally"]){t.Promise.prototype["finally"]=e}});