@galacean/effects-plugin-alipay-downgrade 1.1.0 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
package/dist/index.min.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Description: Galacean Effects player downgrade plugin for Alipay
|
|
4
4
|
* Author: Ant Group CO., Ltd.
|
|
5
5
|
* Contributors: 燃然,意绮
|
|
6
|
-
* Version: v1.1.
|
|
6
|
+
* Version: v1.1.2
|
|
7
7
|
*/
|
|
8
8
|
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("@galacean/effects")):"function"==typeof define&&define.amd?define(["exports","@galacean/effects"],n):n(((e="undefined"!=typeof globalThis?globalThis:e||self).ge=e.ge||{},e.ge.alipayDowngradePlugin={}),e.ge)}(this,(function(e,n){"use strict";var r=function(e,n){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])},r(e,n)};function o(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}r(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}function t(e,n,r,o){return new(r||(r=Promise))((function(t,i){function a(e){try{l(o.next(e))}catch(e){i(e)}}function c(e){try{l(o.throw(e))}catch(e){i(e)}}function l(e){var n;e.done?t(e.value):(n=e.value,n instanceof r?n:new r((function(e){e(n)}))).then(a,c)}l((o=o.apply(e,n||[])).next())}))}function i(e,n){var r,o,t,i,a={label:0,sent:function(){if(1&t[0])throw t[1];return t[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(c){return function(l){return function(c){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(a=0)),a;)try{if(r=1,o&&(t=2&c[0]?o.return:c[0]?o.throw||((t=o.return)&&t.call(o),0):o.next)&&!(t=t.call(o,c[1])).done)return t;switch(o=0,t&&(c=[2&c[0],t.value]),c[0]){case 0:case 1:t=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,o=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(t=a.trys,(t=t.length>0&&t[t.length-1])||6!==c[0]&&2!==c[0])){a=0;continue}if(3===c[0]&&(!t||c[1]>t[0]&&c[1]<t[3])){a.label=c[1];break}if(6===c[0]&&a.label<t[1]){a.label=t[1],t=c;break}if(t&&a.label<t[2]){a.label=t[2],a.ops.push(c);break}t[2]&&a.ops.pop(),a.trys.pop();continue}c=n.call(e,a)}catch(e){c=[6,e],o=0}finally{r=t=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,l])}}}function a(e,n){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var o,t,i=r.call(e),a=[];try{for(;(void 0===n||n-- >0)&&!(o=i.next()).done;)a.push(o.value)}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return a}function c(e,n,r){if(r||2===arguments.length)for(var o,t=0,i=n.length;t<i;t++)!o&&t in n||(o||(o=Array.prototype.slice.call(n,0,t)),o[t]=n[t]);return e.concat(o||Array.prototype.slice.call(n))}"function"==typeof SuppressedError&&SuppressedError;var l,u,s="low",d="middle",f="high",p="DESKTOP_DEBUG",v=!1;function y(){return t(this,void 0,void 0,(function(){return i(this,(function(e){return l||(l=function(){return t(this,void 0,void 0,(function(){return i(this,(function(e){return[2,new Promise((function(e,n){var r=window.AlipayJSBridge;r?r.call("getSystemInfo",(function(r){r.error?n(r):e(r)})):n("no ap")}))]}))}))}().then((function(e){var n=e.performance,r=e.platform,o=e.model;if(u||(u=n),v="iOS"===r,/iPhone(\d+),/.test(p=void 0===o?"UNKNOWN_DEVICE":o)&&!u){var t=+RegExp.$1;u=t<=9?s:t<10?d:f}return 0===p.indexOf(e.brand)&&(p=p.replace(e.brand,"").trim()),p}),(function(e){}))),[2,l.then((function(){return p}),(function(){return p}))]}))}))}function g(e){return"auto"!==e&&e?/[ABS]/.test(e)?e:n.spec.RenderLevel.S:u===f?n.spec.RenderLevel.S:u===d?n.spec.RenderLevel.A:u===s?n.spec.RenderLevel.B:v?n.spec.RenderLevel.S:n.spec.RenderLevel.B}var h="mock-fail";function w(e,r){return void 0===r&&(r={}),t(this,void 0,void 0,(function(){var o,t;return i(this,(function(i){return e===h||"mock-pass"===e?[2,Promise.resolve({downgrade:e===h,reason:"mock"})]:(o=window.AlipayJSBridge)?(t=performance.now(),[2,y().then((function(){return new Promise((function(i){var l,p=["mars"],v=r.techPoint;v&&p.push.apply(p,c([],a(v),!1)),(null!==(l=r.callBridge)&&void 0!==l?l:o.call)("getDowngradeResult",{bizId:e,scene:0,ext:{techPoint:p}},(function(e){var r=void 0;if(console.info("downgrade time: ".concat(performance.now()-t,"ms")),e.error)i({downgrade:4!==e.error,reason:"api error:"+e.error});else try{var o=n.isString(e)?JSON.parse(e):e;if("downgradeResultType"in o?r=o.downgradeResultType:"resultType"in o&&(r=o.resultType),e.context){var a=e.context.deviceInfo;if(a){var c=a.deviceLevel;c===f||c===s?u=c:"medium"===c&&(u=d)}}}catch(e){console.error(e)}i(void 0===r?{downgrade:!0,reason:"call downgrade fail"}:{reason:r,downgrade:1===r})}))}))}))]):[2,Promise.resolve({downgrade:!1,reason:"no AP env"})]}))}))}var b=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return o(n,e),n.onPlayerCreated=function(e){return t(this,void 0,void 0,(function(){return i(this,(function(r){switch(r.label){case 0:return n.glLostOccurred?(console.warn("gl lost happened, new player will be destroyed."),[2,e.dispose()]):n.currentBizId?[4,w(n.currentBizId)]:[3,2];case 1:r.sent().downgrade&&(console.warn("automatically destroy downgraded player."),e.dispose()),r.label=2;case 2:return[2]}}))}))},n.processRawJSON=function(e,r){var o,a;return void 0===r&&(r={}),t(this,void 0,void 0,(function(){var e;return i(this,(function(t){switch(t.label){case 0:return n.glLostOccurred?[2,Promise.reject("gl lost happened")]:[4,w(null!==(a=null===(o=r.pluginData)||void 0===o?void 0:o.alipayBizId)&&void 0!==a?a:n.currentBizId)];case 1:if((e=t.sent()).downgrade)throw new Error("downgraded, reason: ".concat(e.reason));return r.renderLevel||(r.renderLevel=g(r.renderLevel)),[2]}}))}))},n.currentBizId="",n.glLostOccurred=!1,n}(n.AbstractPlugin),m=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return o(n,e),n}(n.VFXItem),P="[Galacean Effects Player]";function L(){var e=console.info,r=console.warn,o=console.error;console.error=function(e){for(var r=[],t=1;t<arguments.length;t++)r[t-1]=arguments[t];n.isObject(e)&&e.type===n.LOG_TYPE?(o.apply(console,c([P,e.content],a(r),!1)),E.apply(void 0,c(["error",e.content],a(r),!1))):o.apply(console,c([e],a(r),!1))},console.info=function(r){for(var o=[],t=1;t<arguments.length;t++)o[t-1]=arguments[t];n.isObject(r)&&r.type===n.LOG_TYPE?(e.apply(console,c([P,r.content],a(o),!1)),E.apply(void 0,c(["info",r.content],a(o),!1))):e.apply(console,c([r],a(o),!1))},console.warn=function(e){for(var o=[],t=1;t<arguments.length;t++)o[t-1]=arguments[t];n.isObject(e)&&e.type===n.LOG_TYPE?(r.apply(console,c([P,e.content],a(o),!1)),E.apply(void 0,c(["info",e.content],a(o),!1))):r.apply(console,c([e],a(o),!1))}}function E(e,r){for(var o=[],t=2;t<arguments.length;t++)o[t-2]=arguments[t];n.isAndroid()?O.apply(void 0,c([e,"".concat(P," ").concat(r)],a(o),!1)):n.isIOS()&&S.apply(void 0,c([e,r],a(o),!1))}function S(e,n){for(var r=[],o=2;o<arguments.length;o++)r[o-2]=arguments[o];try{var t=window.AlipayJSBridge,i=A.apply(void 0,c([e,n],a(r),!1));null==t||t.call("H5APLog",{content:i})}catch(e){console.error(e)}}function O(e,n){for(var r=[],o=2;o<arguments.length;o++)r[o-2]=arguments[o];try{var t=window.AlipayJSBridge;null==t||t.call("localLog",{anr_info:"mars",message:n+r.join(""),level:e})}catch(e){console.error(e)}}function A(e,n){for(var r=[],o=2;o<arguments.length;o++)r[o-2]=arguments[o];var t=["<MARS_PLAYER>","(".concat(e,"):"),n];return r.forEach((function(e){t.push(e+"")})),t.join(" ")}var B=!1;var _=Symbol("@@_inter_pause");function x(e){e.target===document&&(console.debug("auto pause all players with data offloaded"),n.getActivePlayers().forEach((function(e){e.paused||(e.pause({offloadTexture:!0}),e[_]=!0)})))}function I(e){e.target===document&&(console.debug("auto resume all players"),n.getActivePlayers().forEach((function(e){e[_]&&(e.resume(),e[_]=!1)})))}e.checkDowngrade=w,e.getAlipayDowngradeBizId=function(){return b.currentBizId},e.getDeviceName=y,e.getRenderLevelByDevice=g,e.inspectLogger=L,e.resetDevicePending=function(){l=void 0},e.setAlipayDowngradeBizId=function(e,r){void 0===r&&(r={});var o=r.ignoreGLLost,t=r.autoPause,i=!0!==o;b.currentBizId=e,B||(n.registerPlugin("alipay-downgrade",b,m,!0),window.addEventListener("unload",(function(){n.getActivePlayers().forEach((function(e){return e.dispose()}))})),window.addEventListener("webglcontextlost",(function(e){n.isCanvasUsedByPlayer(e.target)&&(b.glLostOccurred=!0,console.error("webgl lost occur"),i&&(console.warn("webgl lost occur, all players will be downgraded from now on"),n.disableAllPlayer(!0),n.getActivePlayers().forEach((function(e){return e.dispose()}))))}),!0),t&&(document.addEventListener("pause",x),document.addEventListener("resume",I)),B=!0,L(),y())},Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
9
9
|
//# sourceMappingURL=index.min.js.map
|
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Description: Galacean Effects player downgrade plugin for Alipay
|
|
4
4
|
* Author: Ant Group CO., Ltd.
|
|
5
5
|
* Contributors: 燃然,意绮
|
|
6
|
-
* Version: v1.1.
|
|
6
|
+
* Version: v1.1.2
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { spec, isString, AbstractPlugin, VFXItem, isObject, LOG_TYPE, isAndroid, isIOS as isIOS$1, registerPlugin, getActivePlayers, isCanvasUsedByPlayer, disableAllPlayer } from '@galacean/effects';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@galacean/effects-plugin-alipay-downgrade",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "Galacean Effects player downgrade plugin for Alipay",
|
|
5
5
|
"module": "./dist/index.mjs",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"registry": "https://registry.npmjs.org"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@galacean/effects": "1.1.
|
|
34
|
+
"@galacean/effects": "1.1.2"
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
37
37
|
"dev": "vite",
|