New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

windmill-module-api

Package Overview
Dependencies
Maintainers
1
Versions
91
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

windmill-module-api - npm Package Compare versions

Comparing version 0.2.58 to 0.2.59

96

index.js

@@ -1,2 +0,2 @@

/* windmill-module-api (0.2.58), build at 2018-12-19 15:45. */
/* windmill-module-api (0.2.59), build at 2018-12-20 14:14. */

@@ -156,27 +156,2 @@ (function (global, factory) {

/**
* 拦截并预处理模块的参数
*/
var preprocessorMap = {};
function preprocess(api, options) {
var processor = preprocessorMap[api];
if (isFunction(processor) && isPlainObject(options)) {
return processor(options);
}
else {
return options;
}
}
/**
* 注册模块参数的预处理器,用于注入特殊的处理逻辑
*/
function registerPreprocessor(my, map) {
if (isPlainObject(my) && isPlainObject(map)) {
for (var api in map) {
if (hasOwn(my, api) && typeof map[api] === 'function') {
preprocessorMap[api] = map[api];
}
}
}
}
/**
* Generate uniqueId

@@ -317,6 +292,7 @@ */

var MyBase = function MyBase(options) {
var MyBase = function MyBase(options, api) {
this._options = {};
this._callModuleConfig = {};
this._moduleAPI = {};
this._callModuleConfig = {};
this._preprocessorMap = {};
if (options && options.label) {

@@ -327,5 +303,6 @@ this._callModuleConfig.modifier = {

}
this._moduleAPI = api;
this._registerModuleApi();
if (options && options.preprocessor) {
registerPreprocessor(my, options.preprocessor);
this._registerPreprocessor(options.preprocessor);
}

@@ -337,4 +314,3 @@ if (options && options.errorHandler) {

MyBase.prototype.createContext = function createContext () {
var context = Object.assign({}, this._moduleAPI);
Object.defineProperty(context, PRIVATE_PROP_KEY, {
Object.defineProperty(this._moduleAPI, PRIVATE_PROP_KEY, {
enumerable: false,

@@ -346,6 +322,8 @@ configurable: false,

_callModuleSync: this._callModuleSync,
_callModuleConfig: this._callModuleConfig
_callModuleConfig: this._callModuleConfig,
_preprocess: this._preprocess,
_preprocessorMap: this._preprocessorMap
}
});
return context;
return this._moduleAPI;
};

@@ -370,3 +348,3 @@ MyBase.prototype._registerModuleApi = function _registerModuleApi () {

if (this$1._moduleAPI[scope] && !isPlainObject(this$1._moduleAPI[scope])) {
console.error(("\"my." + scope + "\" is already existed and can't be overridded."));
console.error(("\"my." + scope + "\" is already existed and can't be overridden."));
return;

@@ -378,3 +356,3 @@ }

if (myScope[map.apiName]) {
console.warn(("my." + scope + "." + (map.apiName) + " is already existed and will be overridded."));
console.warn(("my." + scope + "." + (map.apiName) + " is already existed and will be overridden."));
}

@@ -393,2 +371,26 @@ myScope[map.apiName] = function (options) {

/**
* 拦截并预处理模块的参数
*/
MyBase.prototype._preprocess = function _preprocess (api, options) {
var processor = this._preprocessorMap[api];
if (isFunction(processor) && isPlainObject(options)) {
return processor(options);
}
else {
return options;
}
};
/**
* 注册模块参数的预处理器,用于注入特殊的处理逻辑
*/
MyBase.prototype._registerPreprocessor = function _registerPreprocessor (map) {
if (isPlainObject(this._moduleAPI) && isPlainObject(map)) {
for (var api in map) {
if (hasOwn(this._moduleAPI, api) && typeof map[api] === 'function') {
this._preprocessorMap[api] = map[api];
}
}
}
};
/**
* 真实调用原生模块(异步)

@@ -448,3 +450,3 @@ * @param methodPath 模块调用的字符串,形如 "modal.toast"

options = preprocess('tradePay', options);
options = this[PRIVATE_PROP_KEY]._preprocess('tradePay', options);
this[PRIVATE_PROP_KEY]._callModule('alipay.tradePay', options);

@@ -736,3 +738,3 @@ }

function getNetworkType(options) {
options = preprocess('getNetworkType', options);
options = this[PRIVATE_PROP_KEY]._preprocess('getNetworkType', options);
this[PRIVATE_PROP_KEY]._callModule('connection.getType', options, {}, function (res) {

@@ -762,3 +764,3 @@ var type = res.type || '';

function choosePhoneContact(options) {
options = preprocess('choosePhoneContact', options);
options = this[PRIVATE_PROP_KEY]._preprocess('choosePhoneContact', options);
this[PRIVATE_PROP_KEY]._callModule('contact.choosePhoneContact', options, {}, function (res) {

@@ -1005,3 +1007,3 @@ return {

function sendMtop(options) {
this[PRIVATE_PROP_KEY]._callModule('sendMtop.request', preprocess('sendMtop', options));
this[PRIVATE_PROP_KEY]._callModule('sendMtop.request', this[PRIVATE_PROP_KEY]._preprocess('sendMtop', options));
}

@@ -1089,3 +1091,3 @@

options = preprocess('navigateTo', options);
options = this[PRIVATE_PROP_KEY]._preprocess('navigateTo', options);
var url = resolvePathname(options.url, basePath) || '';

@@ -1097,3 +1099,3 @@ this[PRIVATE_PROP_KEY]._callModule('navigator.push', options, {

function navigateBack(options) {
this[PRIVATE_PROP_KEY]._callModule('navigator.pop', preprocess('navigateBack', options));
this[PRIVATE_PROP_KEY]._callModule('navigator.pop', this[PRIVATE_PROP_KEY]._preprocess('navigateBack', options));
}

@@ -1103,3 +1105,3 @@ function redirectTo(options) {

options = preprocess('redirectTo', options);
options = this[PRIVATE_PROP_KEY]._preprocess('redirectTo', options);
this[PRIVATE_PROP_KEY]._callModule('navigator.redirectTo', options, {

@@ -1112,3 +1114,3 @@ url: formatPath(options.url)

options = preprocess('switchTab', options);
options = this[PRIVATE_PROP_KEY]._preprocess('switchTab', options);
this[PRIVATE_PROP_KEY]._callModule('navigator.switchTab', options, {

@@ -1164,3 +1166,3 @@ url: formatPath(options.url)

options = preprocess('httpRequest', options);
options = this[PRIVATE_PROP_KEY]._preprocess('httpRequest', options);
var method = options.method || 'GET';

@@ -1750,5 +1752,7 @@ // GET 请求不支持 body 方式传递参数,需要使用 url 传参。

function My(options) {
MyBase$$1.call(this, options);
if ( options === void 0 ) options = {};
var api = Object.assign({}, moduleAPI, { canIUse: function (x) { return x in moduleAPI; } });
MyBase$$1.call(this, options, api);
listenModuleAPIEvent();
this._moduleAPI = Object.assign({}, moduleAPI, { canIUse: function (x) { return x in moduleAPI; } });
}

@@ -1755,0 +1759,0 @@

@@ -1,2 +0,2 @@

/* windmill-module-api (0.2.58), build at 2018-12-19 15:45. */
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t["windmill-module-api"]=e()}(this,function(){"use strict";var e="__WINDMILL_WORKER_RUNTIME_APIS__",o="[[JSON]]",n=/^\[\[JSON\]\].*/,i="function"==typeof Symbol?Symbol():"[[PRIVATE_PROP_KEY]]";function a(){return"undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:new Function("return this")()}var r="__WINDMILL_MODULE_GETTER__";function c(t){var e=a();return e&&"function"==typeof e[r]?e[r](t):e&&"function"==typeof e.require?e.require("@core/"+t):(console.error('Can\'t find available "require" function.'),e&&e&&"function"==typeof e.requireModule?e.requireModule(t):e&&e.weex&&"function"==typeof e.weex.requireModule?e.weex.requireModule("@windmill/"+t):void 0)}var l="[[EVENT_MAP]]";function u(t,e){var o=t[l];return Array.isArray(o[e])||(o[e]=[]),o[e]}var s,d=function(){Object.defineProperty(this,l,{configurable:!1,enumerable:!1,writable:!1,value:{}})};function f(t){return Object.prototype.toString.call(t).slice(8,-1)}function h(t){return"Object"===f(t)}function p(t){return"Array"===f(t)}function g(){return"object"==typeof __windmill_environment__?__windmill_environment__:"object"==typeof wmlEnv?wmlEnv:"object"==typeof windmillEnv?windmillEnv:{}}function m(){if(!s){var t=a();s=t[e]}return s}function v(){return m().$getCurrentActivePageId()}d.prototype.on=function(t,e){return u(this,t).push({listener:e,once:!1,callCount:0}),this},d.prototype.once=function(t,e){return u(this,t).push({listener:e,once:!0,callCount:0}),this},d.prototype.off=function(t,e){var o=this[l];if(e){var n=o[t];if(Array.isArray(n)){var i=n.findIndex(function(t){return t.listener===e});-1!==i&&n.splice(i,1)}}else delete o[t];return this},d.prototype.emit=function(t){for(var e=[],o=arguments.length-1;0<o--;)e[o]=arguments[o+1];var n=this[l],i=n[t];return Array.isArray(i)&&(n[t]=i.filter(function(t){try{t.listener.apply(null,e),t.callCount+=1}catch(t){return!0}return!t.once})),this};var _={};function y(t,e){var o=_[t];return"function"==typeof o&&h(e)?o(e):e}var M,S=(M=1e5,function(){var t=String(M);return M+=1,t});function w(t,e){var o=v(),n="[[ModuleAPIEvent]]@"+o;m().$emit(n,{type:t,data:e},o)}var b=new d;var I=["success","fail","complete"];function T(t){var e={};for(var o in t)-1===I.indexOf(o)&&(e[o]=t[o]);return e}function k(o,t){var n=m();if(n){if(t&&"function"==typeof n.$callSync)return function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return n.$callSync.apply(n,[o].concat(t))};if(!t&&"function"==typeof n.$call)return function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return n.$call.apply(n,[o].concat(t))}}var e=o.split(/\s*\.\s*/i),i=e[0],a=e[1];if(i&&a){var r=c(i);if(r&&"function"==typeof r[a])return r[a]}return function(){}}function C(t,e){if("function"==typeof t)try{return t.apply(null,e)}catch(t){console.error("Failed to execute internal method: "+t.toString())}}var P=function(t,e){console.error('Failed to execute callback of "'+t+'": '+e.toString())};function B(e,t,o){if("function"==typeof t)try{return t.apply(null,o)}catch(t){P(e,t)}}var t=function(t){var e;this._options={},this._moduleAPI={},this._callModuleConfig={},t&&t.label&&(this._callModuleConfig.modifier={origin:t.label}),this._registerModuleApi(),t&&t.preprocessor&&function(t,e){if(h(t)&&h(e))for(var o in e)n=t,i=o,Object.prototype.hasOwnProperty.call(n,i)&&"function"==typeof e[o]&&(_[o]=e[o]);var n,i}(my,t.preprocessor),t&&t.errorHandler&&"function"==typeof(e=t.errorHandler)&&(P=e)};t.prototype.createContext=function(){var t=Object.assign({},this._moduleAPI);return Object.defineProperty(t,i,{enumerable:!1,configurable:!1,writable:!1,value:{_callModule:this._callModule,_callModuleSync:this._callModuleSync,_callModuleConfig:this._callModuleConfig}}),t},t.prototype._registerModuleApi=function(){var i=this,t=m();t&&t.$on("registerModuleAPI",function(t){var e=t.data,o=e.scope;if(o)if(p(e.map))if(!i._moduleAPI[o]||h(i._moduleAPI[o])){var n=i._moduleAPI[o]=i._moduleAPI[o]||{};e.map.forEach(function(e){n[e.apiName]&&console.warn("my."+o+"."+e.apiName+" is already existed and will be overridded."),n[e.apiName]=function(t){return e.isSync?i._callModuleSync(e.moduleMethod,t):i._callModule(e.moduleMethod,t)}})}else console.error('"my.'+o+"\" is already existed and can't be overridded.");else console.error('"data.map" is undefined or not a array on "registerModuleAPI" event.');else console.error('"data.scope" is undefined on "registerModuleAPI" event.')})},t.prototype._callModule=function(o,n,t,i,a){void 0===n&&(n={}),void 0===t&&(t=n),void 0===i&&(i=function(t){return t}),void 0===a&&(a=function(t){return t});var e=k(o),r=!1;return e(T(t),function(t){var e=C(i,[t]);B(o,n.success,[e]),r||(B(o,n.complete,[e]),r=!0)},function(t){var e=C(a,[t]);B(o,n.fail,[e]),r||(B(o,n.complete,[e]),r=!0)},this._callModuleConfig.modifier)},t.prototype._callModuleSync=function(t,e){return void 0===e&&(e={}),k(t,!0)(T(e),this._callModuleConfig.modifier)};var A=["opacity","backgroundColor","width","height","top","left","bottom","right","rotate","rotateX","rotateY","rotateZ","rotate3d","skew","skewX","skewY","scale","scaleX","scaleY","scaleZ","scale3d","translate","translateX","translateY","translateZ","translate3d","matrix","matrix3d"],E=function(){var n=this;this.animations=[],this.currentAnimation=[],this.config={},A.forEach(function(o){n[o]=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return n.currentAnimation.push([o,t]),n}})};E.prototype.step=function(t){return this.animations.push({config:Object.assign({},this.config,t),animation:this.currentAnimation}),this.currentAnimation=[],this},E.prototype.export=function(){var t=this.animations;return this.animations=[],t};var x=function(e){function t(t){e.call(this),this.config=Object.assign({transformOrigin:"50% 50% 0",duration:400,timeFunction:"linear",delay:0},t)}return e&&(t.__proto__=e),(t.prototype=Object.create(e&&e.prototype)).constructor=t}(E);var N=function(t){void 0===t&&(t={}),this._instanceId=S(),this._emitter=new d,this.src=t.src};N.prototype.play=function(t){var e=this;this[i]._callModule("audioPlayer.playVoice",t,{src:this.src,instanceId:this._instanceId},function(t){return 1===t.isComplete?e._emitter.emit("stop"):(e.duration=t.duration,e._emitter.emit("play")),t},function(t){return e._emitter.emit("error",t),t})},N.prototype.pause=function(t){var e=this;this[i]._callModule("audioPlayer.pauseVoice",t,{instanceId:this._instanceId},function(t){return e._emitter.emit("pause"),t},function(t){return e._emitter.emit("error",t),t})},N.prototype.stop=function(t){var e=this;this[i]._callModule("audioPlayer.stopVoice",t,{instanceId:this._instanceId},function(t){return e._emitter.emit("stop"),t},function(t){return e._emitter.emit("error",t),t})},N.prototype.onPlay=function(t){this._emitter.on("play",t)},N.prototype.onPause=function(t){this._emitter.on("pause",t)},N.prototype.onStop=function(t){this._emitter.on("stop",t)},N.prototype.onError=function(t){this._emitter.on("error",t)},N.prototype.offPlay=function(t){this._emitter.off("play",t)},N.prototype.offPause=function(t){this._emitter.off("pause",t)},N.prototype.offStop=function(t){this._emitter.off("stop",t)},N.prototype.offError=function(t){this._emitter.off("error",t)};var F,O=function(){this._startEmitted=!1,this._emitter=new d};O.prototype.start=function(t){var e=this;void 0===t&&(t={}),this._startEmitted=!1,this[i]._callModule("audioRecord.startRecord",t,{maxDuration:t.duration/1e3,minDuration:1},function(t){return t.averagePower&&!e._startEmitted&&(e._emitter.emit("start",{}),e._startEmitted=!0),t.apFilePath&&e._emitter.emit("stop",{tempFilePath:t.apFilePath,duration:t.duration}),t},function(t){return e._emitter.emit("error",t),t})},O.prototype.stop=function(t){var e=this;void 0===t&&(t={}),this[i]._callModule("audioRecord.stopRecord",t,t,function(t){return e._emitter.emit("stop",{tempFilePath:t.apFilePath,duration:t.duration}),t},function(t){return e._emitter.emit("error",t),t})},O.prototype.onStart=function(t){this._emitter.on("start",t)},O.prototype.onStop=function(t){this._emitter.on("stop",t)},O.prototype.onError=function(t){this._emitter.on("error",t)},O.prototype.offStart=function(t){this._emitter.off("start",t)},O.prototype.offStop=function(t){this._emitter.off("stop",t)},O.prototype.offError=function(t){this._emitter.off("error",t)};var L,D=["setTextAlign","setTextBaseline","setFillStyle","setStrokeStyle","setShadow","createLinearGradient","createCircularGradient","addColorStop","setLineWidth","setLineCap","setLineJoin","setMiterLimit","rect","fillRect","strokeRect","clearRect","fill","stroke","beginPath","closePath","moveTo","lineTo","arc","bezierCurveTo","clip","quadraticCurveTo","scale","rotate","translate","setFontSize","fillText","drawImage","setGlobalAlpha","setLineDash","transform","setTransform","getImageData","p\u200butImageData","save","restore","measureText"],R=function(t){var n=this;this._canvasId=t,this._actions=[],D.forEach(function(o){n[o]=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];n._actions.push({method:o,args:t})}})};function V(t){return h(t)?t.apFilePath||t.filePath:""}R.prototype.draw=function(){w("canvas",{canvasId:this._canvasId,actions:this._actions}),this._actions=[]};var j=["play","stop","pause","setSpeed","goToAndStop","goToAndPlay","getDuration","setDirection","playSegments","destroy"],U=["onAnimationEnd","onAnimationRepeat","onDataReady","onDataFailed","onAnimationStart","onAnimationCancel"],q=function(n){var i=this;j.forEach(function(o){i[o]=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];w("lottie",{lottieId:n,action:{method:o,args:t}})}}),U.forEach(function(t){i[t]=function(o){b.on("lottie."+t,function(t){var e=[];t.event&&t.event.args&&(e=t.event.args),t.lottieId===n&&o.apply(i,e)})}})};function W(t){return"/"===t.charAt(0)}function z(t,e){for(var o=e,n=o+1,i=t.length;n<i;o+=1,n+=1)t[o]=t[n];t.pop()}function H(t){return void 0===t&&(t=""),"/"===t[0]?t.slice(1):t}function K(t){return o+JSON.stringify(t.data)}function $(t){return{data:n.test(t.value)?JSON.parse(t.value.substr(o.length)):t.value}}function G(){var t=g();return{model:t.model,pixelRatio:t.pixelRatio,windowWidth:t.screenWidth,windowHeight:t.screenHeight,language:t.language,version:t.appVersion,storage:null,currentBattery:null,system:t.systemVersion,platform:t.platform,screenWidth:t.screenWidth,screenHeight:t.screenHeight,brand:t.brand,fontSizeSetting:14,app:t.appName,SDKVersion:t.version,frameworkType:t.frameworkType,frameworkVersion:t.frameworkVersion,userAgent:t.userAgent,screenDensity:t.screenDensity}}var J=g().version||"";var Y=["play","pause","stop","requestFullScreen","exitFullScreen","showControls","hideControls","enableLoop","disableLoop"],X=function(a){var t=this;Y.forEach(function(i){t[i]=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var o=v(),n="[[VideoContextAction]]@"+o;m().$emit(n,{action:i,id:a,args:t},o)}})};var Z=new d,Q=["onOpen","onError","onMessage","onClose"],tt=0,et=!1;var ot=Object.freeze({showActionSheet:function(t){this[i]._callModule("actionSheet.showActionSheet",t)},chooseAddress:function(t){this[i]._callModule("address.choose",t)},tradePay:function(t){void 0===t&&(t={}),t=y("tradePay",t),this[i]._callModule("alipay.tradePay",t)},createAnimation:function(t){return new x(t)},createInnerAudioContext:function(t){var e=new N(t);return e[i]=this[i],e},getRecorderManager:function(t){return F||((F=new O)[i]=this[i]),F},createCanvasContext:function(t){return new R(t)},openChat:function(t){this[i]._callModule("chat.open",t)},getClipboard:function(t){this[i]._callModule("clipboard.readText",t)},setClipboard:function(t){void 0===t&&(t={}),this[i]._callModule("clipboard.writeText",t,{text:t.text})},getNetworkType:function(t){t=y("getNetworkType",t),this[i]._callModule("connection.getType",t,{},function(t){return{networkType:(t.type||"").toUpperCase()}})},onNetworkStatusChange:function(t){L||(L=new d,c("connection").onChange({},function(t){var e=t.type||"";L.emit("networkStatusChange",{networkType:e.toUpperCase()})})),L.on("networkStatusChange",t)},offNetworkStatusChange:function(){L.off("networkStatusChange")},choosePhoneContact:function(t){t=y("choosePhoneContact",t),this[i]._callModule("contact.choosePhoneContact",t,{},function(t){return{name:t.name,mobile:t.phone}})},watchShake:function(t){this[i]._callModule("device.onShake",t,{on:!0})},vibrate:function(t){this[i]._callModule("device.vibrate",t)},vibrateShort:function(t){this[i]._callModule("device.vibrateShort",t)},onUserCaptureScreen:function(t){this[i]._callModule("device.onUserCaptureScreen",{success:t})},offUserCaptureScreen:function(){this[i]._callModule("device.offUserCaptureScreen")},scan:function(t){this[i]._callModule("device.scan",t)},saveFile:function(t){return this[i]._callModule("file.saveFile",t,{filePath:V(t)},function(t){return{apFilePath:t.savedFilePath}})},getFileInfo:function(t){return this[i]._callModule("file.getFileInfo",t,{filePath:V(t)},function(t){return{size:t.size}})},getSavedFileInfo:function(t){return this[i]._callModule("file.getFileInfo",t,{filePath:V(t)})},getSavedFileList:function(t){return this[i]._callModule("file.getFileList",t,{},function(t){var e=[];return p(t.fileList)&&(e=t.fileList.map(function(t){return{size:t.size,createTime:t.createTime,apFilePath:t.filePath}})),{fileList:e}})},removeSavedFile:function(t){return this[i]._callModule("file.removeFile",t,{filePath:V(t)})},chooseImage:function(t){this[i]._callModule("image.chooseImage",t)},compressImage:function(t){this[i]._callModule("image.compressImage",t)},previewImage:function(t){this[i]._callModule("image.previewImage",t)},saveImage:function(t){this[i]._callModule("image.saveImage",t)},getImageInfo:function(t){this[i]._callModule("image.getImageInfo",t)},hideKeyboard:function(){this[i]._callModule("keyboard.hideKeyboard")},getLocation:function(t){var o=t.type;this[i]._callModule("location.getLocation",t,t,function(t){var e={longitude:t.coords.longitude,latitude:t.coords.latitude,accuracy:t.coords.accuracy};return 0<o&&t.address&&(e.country=t.address.country,e.province=t.address.province,e.city=t.address.city,e.cityAdcode=t.address.cityCode,e.district=t.address.area,e.districtAdcode=t.address.areaCode),e})},createLottieContext:function(t){return new q(t)},setBackgroundImage:function(t){this[i]._callModule("miniApp.setWebViewBackgroundImage",t)},removeBackgroundImage:function(t){this[i]._callModule("miniApp.setWebViewBackgroundImage",t,{color:"",imgUrl:""})},setViewTop:function(t){this[i]._callModule("miniApp.setWebViewTop",t)},setCanPullDown:function(t){this[i]._callModule("miniApp.setWebViewParams",t)},setShareAppMessage:function(t){void 0===t&&(t={});var e=t.title,o=t.desc,n=t.imageUrl;this[i]._callModule("miniApp.setAppShareInfo",t,{title:e,description:o,imageUrl:n})},pageScrollTo:function(t){void 0===t&&(t={}),w("pageScrollTo",{scrollTop:t.scrollTop})},alert:function(t){void 0===t&&(t={}),this[i]._callModule("modal.alert",t,{title:t.title,message:t.content,okTitle:t.buttonText})},confirm:function(t){void 0===t&&(t={});var e=t.confirmButtonText||"\u786e\u5b9a",o=t.cancelButtonText||"\u53d6\u6d88";this[i]._callModule("modal.confirm",t,{title:t.title,message:t.content,okTitle:e,cancelTitle:o},function(t){return{confirm:t.data===e}})},showToast:function(t){void 0===t&&(t={}),t.duration||(t.duration=2e3),this[i]._callModule("modal.toast",t,{message:t.content,duration:t.duration/1e3})},hideToast:function(t){this[i]._callModule("modal.hideToast",t)},prompt:function(t){this[i]._callModule("modal.prompt",t)},showLoading:function(t){this[i]._callModule("modal.showLoading",t)},hideLoading:function(t){this[i]._callModule("modal.hideLoading",t)},sendMtop:function(t){this[i]._callModule("sendMtop.request",y("sendMtop",t))},navigateTo:function(t,e){void 0===t&&(t={}),void 0===e&&(e="");var o=function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"",o=t&&t.split("/")||[],n=e&&e.split("/")||[],i=t&&W(t),a=e&&W(e),r=i||a;if(t&&W(t)?n=o:o.length&&(n.pop(),n=n.concat(o)),!n.length)return"/";var c=void 0;if(n.length){var l=n[n.length-1];c="."===l||".."===l||""===l}else c=!1;for(var u=0,s=n.length;0<=s;s--){var d=n[s];"."===d?z(n,s):".."===d?(z(n,s),u++):u&&(z(n,s),u--)}if(!r)for(;u--;u)n.unshift("..");!r||""===n[0]||n[0]&&W(n[0])||n.unshift("");var f=n.join("/");return c&&"/"!==f.substr(-1)&&(f+="/"),f}((t=y("navigateTo",t)).url,e)||"";this[i]._callModule("navigator.push",t,{url:H(o)})},navigateBack:function(t){this[i]._callModule("navigator.pop",y("navigateBack",t))},redirectTo:function(t){void 0===t&&(t={}),t=y("redirectTo",t),this[i]._callModule("navigator.redirectTo",t,{url:H(t.url)})},switchTab:function(t){void 0===t&&(t={}),t=y("switchTab",t),this[i]._callModule("navigator.switchTab",t,{url:H(t.url)})},navigateToMiniProgram:function(t){this[i]._callModule("navigator.navigateToMiniProgram",t)},navigateBackMiniProgram:function(t){this[i]._callModule("navigator.navigateBackMiniProgram",t)},setNavigationBar:function(t){this[i]._callModule("navigatorBar.setNavigationBar",t)},getStatusBarHeight:function(t){this[i]._callModule("navigatorBar.getStatusBarHeight",t,t,function(t){return{height:parseInt(t.data)}})},getNavigationBarHeight:function(t){this[i]._callModule("navigatorBar.getHeight",t,t,function(t){return{height:parseInt(t.data)}})},showNavigationBarLoading:function(t){this[i]._callModule("navigatorBar.showNavigationBarLoading",t)},hideNavigationBarLoading:function(t){this[i]._callModule("navigatorBar.hideNavigationBarLoading",t)},setNavigationBarDrawer:function(t){this[i]._callModule("navigatorBar.setDrawer",t)},openNavigationBarDrawer:function(t){this[i]._callModule("navigatorBar.openDrawer",t)},closeNavigationBarDrawer:function(t){this[i]._callModule("navigatorBar.closeDrawer",t)},setNavigationBarSheet:function(t){this[i]._callModule("navigatorBar.setActionSheet",t)},httpRequest:function(o){void 0===o&&(o={});var t=(o=y("httpRequest",o)).method||"GET";if("GET"===t&&h(o.data)){var n=[];Object.keys(o.data).forEach(function(t){var e=o.data[t];n.push(t+"="+JSON.stringify(e))});var e=n.join("&");0<=o.url.indexOf("?")?o.url+=e:o.url+="?"+e}this[i]._callModule("network.request",o,{method:t,url:o.url,headers:o.headers||{"Content-Type":"application/x-www-form-urlencoded"},dataType:o.dataType||"json",body:o.data},function(t){return{data:t.data,status:t.status,headers:t.headers}})},uploadFile:function(t){this[i]._callModule("network.uploadFile",t)},downloadFile:function(t){this[i]._callModule("network.downloadFile",t)},makePhoneCall:function(t){void 0===t&&(t={}),this[i]._callModule("phone.makePhoneCall",t,{phoneNumber:t.number})},chooseCity:function(t){void 0===t&&(t={}),t.cities&&Array.isArray(t.cities)&&(t.cities=t.cities.map(function(t){return{cityName:t.city,cityCode:t.adCode,spell:t.spell}})),t.hotCities&&Array.isArray(t.hotCities)&&(t.hotCities=t.hotCities.map(function(t){return{cityName:t.city,cityCode:t.adCode,spell:t.spell}})),this[i]._callModule("picker.chooseCity",t,t,function(t){return{city:t.cityName,adCode:t.cityCode}})},datePicker:function(t){void 0===t&&(t={}),this[i]._callModule("picker.pickDate",t,{format:t.format,value:t.currentDate,min:t.startDate,max:t.endDate},function(t){return{date:t.data}})},setScreenBrightness:function(t){void 0===t&&(t={}),this[i]._callModule("screen.setBrightness",t,{brightness:t.brightness})},getScreenBrightness:function(t){this[i]._callModule("screen.getScreenBrightness",t,t,function(t){return{brightness:t.value}})},setKeepScreenOn:function(t){void 0===t&&(t={}),this[i]._callModule("screen.setAlwaysOn",t,{on:t.keepScreenOn})},shareTinyAppMsg:function(t){this[i]._callModule("share.doShare",t)},showSku:function(t){this[i]._callModule("sku.show",t)},hideSku:function(t){this[i]._callModule("sku.hide",t)},setStorage:function(t){void 0===t&&(t={}),this[i]._callModule("storage.setItem",t,{key:t.key,value:K(t)})},setStorageSync:function(t){return this[i]._callModuleSync("storage.setItemSync",{key:t.key,value:K(t)})},getStorage:function(t){void 0===t&&(t={}),this[i]._callModule("storage.getItem",t,t,$)},getStorageSync:function(t){return $(this[i]._callModuleSync("storage.getItemSync",t))},removeStorage:function(t){void 0===t&&(t={}),this[i]._callModule("storage.removeItem",t)},removeStorageSync:function(t){return void 0===t&&(t={}),this[i]._callModuleSync("storage.removeItemSync",t)},clearStorage:function(t){this[i]._callModule("storage.clearStorage",t)},clearStorageSync:function(t){return this[i]._callModuleSync("storage.clearStorageSync",t)},getStorageInfo:function(t){this[i]._callModule("storage.getStorageInfo",t)},getStorageInfoSync:function(t){return this[i]._callModuleSync("storage.getStorageInfoSync",t)},getSystemInfoSync:G,getSystemInfo:function(e){void 0===e&&(e={});try{"function"==typeof e.success&&e.success.call(this,G())}catch(t){"function"==typeof e.fail&&e.fail.call(this,t)}finally{"function"==typeof e.complete&&e.complete.call(this)}},SDKVersion:J,showTabBar:function(t){this[i]._callModule("tabBar.show",t)},hideTabBar:function(t){this[i]._callModule("tabBar.hide",t)},setTabBarStyle:function(t){this[i]._callModule("tabBar.setTabBarStyle",t)},setTabBarItem:function(t){this[i]._callModule("tabBar.setTabBarItem",t)},setTabBarBadge:function(t){this[i]._callModule("tabBar.setTabBarBadge",t)},removeTabBarBadge:function(t){this[i]._callModule("tabBar.removeTabBarBadge",t)},showTabBarRedDot:function(t){this[i]._callModule("tabBar.showTabBarRedDot",t)},hideTabBarRedDot:function(t){this[i]._callModule("tabBar.hideTabBarRedDot",t)},uccBind:function(t){this[i]._callModule("ucc.uccBind",t)},uccTrustLogin:function(t){this[i]._callModule("ucc.uccTrustLogin",t)},uccUnbind:function(t){this[i]._callModule("ucc.uccUnbind",t)},reportAnalytics:function(t,e){void 0===e&&(e={}),"click"==t||"enter"==t||"expose"==t?k("userTrack.commitut")({type:t,eventId:e.eventId,name:e.name,comName:e.comName,arg1:e.arg1,arg2:e.arg2,arg3:e.arg3,param:e.param}):k("userTrack.customAdvance")({eventId:e.eventId,name:e.name,comName:e.comName,arg1:e.arg1,arg2:e.arg2,arg3:e.arg3,param:e.param})},createVideoContext:function(t){return new X(t)},chooseVideo:function(t){this[i]._callModule("video.chooseVideo",t,t,function(t){return t.apFilePath&&(t.tempFilePath=t.apFilePath,delete t.apFilePath),t})},saveVideoToPhotosAlbum:function(t){this[i]._callModule("video.saveVideoToPhotosAlbum",t)},getAuthUserInfo:function(t){this[i]._callModule("sendMtop.request",t,{api:"mtop.taobao.openlink.openinfo.user.get",v:"1.0",type:"GET"},function(t){var e={nickName:t.data.mixNick,userId:t.data.openId};return t.data.avatar&&(e.avatar=t.data.avatar),t.data.unionId&&(e.unionId=t.data.unionId),e})},getTBCode:function(t){this[i]._callModule("sendMtop.request",t,{api:"mtop.taobao.openlink.basic.login.auth.code",v:"1.0",type:"GET"},function(t){return{code:t.data.result}})},getTBSessionInfo:function(t){this[i]._callModule("wopc.getSessionKey",t,t,function(t){return{data:t}})},setTBSessionInfo:function(t){void 0===t&&(t={}),this[i]._callModule("wopc.setSessionKey",t,t.sessionInfo,function(t){return{success:!0}})},getSetting:function(t){this[i]._callModule("wopc.getSetting",t)},openSetting:function(t){this[i]._callModule("wopc.openSetting",t)},authorize:function(t){this[i]._callModule("wopc.authorize",t)},connectSocket:function(t){var o=this;void 0===t&&(t={}),et&&(this[i]._callModule("webSocket.close",{instanceId:tt}),et=!1,tt++),this[i]._callModule("webSocket.webSocket",t,{instanceId:tt,url:t.url,protocol:""},function(t){return et=!0,t}),Q.forEach(function(e){o[i]._callModule("webSocket."+e,{instanceId:tt,success:function(t){Z.emit(e,t)}})})},sendSocketMessage:function(t){void 0===t&&(t={}),this[i]._callModule("webSocket.send",t,{instanceId:tt,data:t.data})},closeSocket:function(t){this[i]._callModule("webSocket.close",t,{instanceId:tt},function(t){return et=!1,tt++,t})},onSocketOpen:function(t){Z.on("onOpen",t)},offSocketOpen:function(t){Z.off("onOpen",t)},onSocketError:function(t){Z.on("onError",t)},offSocketError:function(t){Z.off("onError",t)},onSocketMessage:function(e){Z.on("onMessage",function(t){e&&e({data:t,isBuffer:!1})})},offSocketMessage:function(t){Z.off("onMessage",t)},onSocketClose:function(t){Z.on("onClose",t)},offSocketClose:function(t){Z.off("onClose",t)}}),nt=function(e){function t(t){e.call(this,t),m().$on("[[ModuleAPIEvent]]",function(t){var e=t.type;void 0===e&&(e="");var o=t.data;void 0===o&&(o={});var n=e;o.event&&o.event.name&&(n+="."+o.event.name),b.emit(n,o)}),this._moduleAPI=Object.assign({},ot,{canIUse:function(t){return t in ot}})}return e&&(t.__proto__=e),(t.prototype=Object.create(e&&e.prototype)).constructor=t}(t);function it(t){var e,o="my";t&&t.defaultName&&(o=t.defaultName);var n=new nt(t).createContext();return(e={})[o]=n,e}return function(e,o,t){void 0===t&&(t=!0);var n=a();try{Object.defineProperty(n,e,{value:o,configurable:!0,enumerable:!0,writable:!t})}catch(t){n[e]=o}}("__WINDMILL_MODULE_API__",{getAPIs:it}),it});
/* windmill-module-api (0.2.59), build at 2018-12-20 14:14. */
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e["windmill-module-api"]=t()}(this,function(){"use strict";var t="__WINDMILL_WORKER_RUNTIME_APIS__",o="[[JSON]]",n=/^\[\[JSON\]\].*/,i="function"==typeof Symbol?Symbol():"[[PRIVATE_PROP_KEY]]";function r(){return"undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:new Function("return this")()}var a="__WINDMILL_MODULE_GETTER__";function c(e){var t=r();return t&&"function"==typeof t[a]?t[a](e):t&&"function"==typeof t.require?t.require("@core/"+e):(console.error('Can\'t find available "require" function.'),t&&t&&"function"==typeof t.requireModule?t.requireModule(e):t&&t.weex&&"function"==typeof t.weex.requireModule?t.weex.requireModule("@windmill/"+e):void 0)}var l="[[EVENT_MAP]]";function s(e,t){var o=e[l];return Array.isArray(o[t])||(o[t]=[]),o[t]}var u,d=function(){Object.defineProperty(this,l,{configurable:!1,enumerable:!1,writable:!1,value:{}})};function f(e){return Object.prototype.toString.call(e).slice(8,-1)}function p(e){return"Object"===f(e)}function h(e){return"Array"===f(e)}function g(){return"object"==typeof __windmill_environment__?__windmill_environment__:"object"==typeof wmlEnv?wmlEnv:"object"==typeof windmillEnv?windmillEnv:{}}function m(){if(!u){var e=r();u=e[t]}return u}function v(){return m().$getCurrentActivePageId()}d.prototype.on=function(e,t){return s(this,e).push({listener:t,once:!1,callCount:0}),this},d.prototype.once=function(e,t){return s(this,e).push({listener:t,once:!0,callCount:0}),this},d.prototype.off=function(e,t){var o=this[l];if(t){var n=o[e];if(Array.isArray(n)){var i=n.findIndex(function(e){return e.listener===t});-1!==i&&n.splice(i,1)}}else delete o[e];return this},d.prototype.emit=function(e){for(var t=[],o=arguments.length-1;0<o--;)t[o]=arguments[o+1];var n=this[l],i=n[e];return Array.isArray(i)&&(n[e]=i.filter(function(e){try{e.listener.apply(null,t),e.callCount+=1}catch(e){return!0}return!e.once})),this};var _,y=(_=1e5,function(){var e=String(_);return _+=1,e});function M(e,t){var o=v(),n="[[ModuleAPIEvent]]@"+o;m().$emit(n,{type:e,data:t},o)}var S=new d;var w=["success","fail","complete"];function b(e){var t={};for(var o in e)-1===w.indexOf(o)&&(t[o]=e[o]);return t}function I(o,e){var n=m();if(n){if(e&&"function"==typeof n.$callSync)return function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return n.$callSync.apply(n,[o].concat(e))};if(!e&&"function"==typeof n.$call)return function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return n.$call.apply(n,[o].concat(e))}}var t=o.split(/\s*\.\s*/i),i=t[0],r=t[1];if(i&&r){var a=c(i);if(a&&"function"==typeof a[r])return a[r]}return function(){}}function T(e,t){if("function"==typeof e)try{return e.apply(null,t)}catch(e){console.error("Failed to execute internal method: "+e.toString())}}var k=function(e,t){console.error('Failed to execute callback of "'+e+'": '+t.toString())};function P(t,e,o){if("function"==typeof e)try{return e.apply(null,o)}catch(e){k(t,e)}}var e=function(e,t){var o;this._options={},this._callModuleConfig={},this._moduleAPI={},this._preprocessorMap={},e&&e.label&&(this._callModuleConfig.modifier={origin:e.label}),this._moduleAPI=t,this._registerModuleApi(),e&&e.preprocessor&&this._registerPreprocessor(e.preprocessor),e&&e.errorHandler&&"function"==typeof(o=e.errorHandler)&&(k=o)};e.prototype.createContext=function(){return Object.defineProperty(this._moduleAPI,i,{enumerable:!1,configurable:!1,writable:!1,value:{_callModule:this._callModule,_callModuleSync:this._callModuleSync,_callModuleConfig:this._callModuleConfig,_preprocess:this._preprocess,_preprocessorMap:this._preprocessorMap}}),this._moduleAPI},e.prototype._registerModuleApi=function(){var i=this,e=m();e&&e.$on("registerModuleAPI",function(e){var t=e.data,o=t.scope;if(o)if(h(t.map))if(!i._moduleAPI[o]||p(i._moduleAPI[o])){var n=i._moduleAPI[o]=i._moduleAPI[o]||{};t.map.forEach(function(t){n[t.apiName]&&console.warn("my."+o+"."+t.apiName+" is already existed and will be overridden."),n[t.apiName]=function(e){return t.isSync?i._callModuleSync(t.moduleMethod,e):i._callModule(t.moduleMethod,e)}})}else console.error('"my.'+o+"\" is already existed and can't be overridden.");else console.error('"data.map" is undefined or not a array on "registerModuleAPI" event.');else console.error('"data.scope" is undefined on "registerModuleAPI" event.')})},e.prototype._preprocess=function(e,t){var o=this._preprocessorMap[e];return"function"==typeof o&&p(t)?o(t):t},e.prototype._registerPreprocessor=function(e){if(p(this._moduleAPI)&&p(e))for(var t in e)o=this._moduleAPI,n=t,Object.prototype.hasOwnProperty.call(o,n)&&"function"==typeof e[t]&&(this._preprocessorMap[t]=e[t]);var o,n},e.prototype._callModule=function(o,n,e,i,r){void 0===n&&(n={}),void 0===e&&(e=n),void 0===i&&(i=function(e){return e}),void 0===r&&(r=function(e){return e});var t=I(o),a=!1;return t(b(e),function(e){var t=T(i,[e]);P(o,n.success,[t]),a||(P(o,n.complete,[t]),a=!0)},function(e){var t=T(r,[e]);P(o,n.fail,[t]),a||(P(o,n.complete,[t]),a=!0)},this._callModuleConfig.modifier)},e.prototype._callModuleSync=function(e,t){return void 0===t&&(t={}),I(e,!0)(b(t),this._callModuleConfig.modifier)};var A=["opacity","backgroundColor","width","height","top","left","bottom","right","rotate","rotateX","rotateY","rotateZ","rotate3d","skew","skewX","skewY","scale","scaleX","scaleY","scaleZ","scale3d","translate","translateX","translateY","translateZ","translate3d","matrix","matrix3d"],C=function(){var n=this;this.animations=[],this.currentAnimation=[],this.config={},A.forEach(function(o){n[o]=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return n.currentAnimation.push([o,e]),n}})};C.prototype.step=function(e){return this.animations.push({config:Object.assign({},this.config,e),animation:this.currentAnimation}),this.currentAnimation=[],this},C.prototype.export=function(){var e=this.animations;return this.animations=[],e};var B=function(t){function e(e){t.call(this),this.config=Object.assign({transformOrigin:"50% 50% 0",duration:400,timeFunction:"linear",delay:0},e)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e}(C);var E=function(e){void 0===e&&(e={}),this._instanceId=y(),this._emitter=new d,this.src=e.src};E.prototype.play=function(e){var t=this;this[i]._callModule("audioPlayer.playVoice",e,{src:this.src,instanceId:this._instanceId},function(e){return 1===e.isComplete?t._emitter.emit("stop"):(t.duration=e.duration,t._emitter.emit("play")),e},function(e){return t._emitter.emit("error",e),e})},E.prototype.pause=function(e){var t=this;this[i]._callModule("audioPlayer.pauseVoice",e,{instanceId:this._instanceId},function(e){return t._emitter.emit("pause"),e},function(e){return t._emitter.emit("error",e),e})},E.prototype.stop=function(e){var t=this;this[i]._callModule("audioPlayer.stopVoice",e,{instanceId:this._instanceId},function(e){return t._emitter.emit("stop"),e},function(e){return t._emitter.emit("error",e),e})},E.prototype.onPlay=function(e){this._emitter.on("play",e)},E.prototype.onPause=function(e){this._emitter.on("pause",e)},E.prototype.onStop=function(e){this._emitter.on("stop",e)},E.prototype.onError=function(e){this._emitter.on("error",e)},E.prototype.offPlay=function(e){this._emitter.off("play",e)},E.prototype.offPause=function(e){this._emitter.off("pause",e)},E.prototype.offStop=function(e){this._emitter.off("stop",e)},E.prototype.offError=function(e){this._emitter.off("error",e)};var x,N=function(){this._startEmitted=!1,this._emitter=new d};N.prototype.start=function(e){var t=this;void 0===e&&(e={}),this._startEmitted=!1,this[i]._callModule("audioRecord.startRecord",e,{maxDuration:e.duration/1e3,minDuration:1},function(e){return e.averagePower&&!t._startEmitted&&(t._emitter.emit("start",{}),t._startEmitted=!0),e.apFilePath&&t._emitter.emit("stop",{tempFilePath:e.apFilePath,duration:e.duration}),e},function(e){return t._emitter.emit("error",e),e})},N.prototype.stop=function(e){var t=this;void 0===e&&(e={}),this[i]._callModule("audioRecord.stopRecord",e,e,function(e){return t._emitter.emit("stop",{tempFilePath:e.apFilePath,duration:e.duration}),e},function(e){return t._emitter.emit("error",e),e})},N.prototype.onStart=function(e){this._emitter.on("start",e)},N.prototype.onStop=function(e){this._emitter.on("stop",e)},N.prototype.onError=function(e){this._emitter.on("error",e)},N.prototype.offStart=function(e){this._emitter.off("start",e)},N.prototype.offStop=function(e){this._emitter.off("stop",e)},N.prototype.offError=function(e){this._emitter.off("error",e)};var F,L=["setTextAlign","setTextBaseline","setFillStyle","setStrokeStyle","setShadow","createLinearGradient","createCircularGradient","addColorStop","setLineWidth","setLineCap","setLineJoin","setMiterLimit","rect","fillRect","strokeRect","clearRect","fill","stroke","beginPath","closePath","moveTo","lineTo","arc","bezierCurveTo","clip","quadraticCurveTo","scale","rotate","translate","setFontSize","fillText","drawImage","setGlobalAlpha","setLineDash","transform","setTransform","getImageData","p\u200butImageData","save","restore","measureText"],O=function(e){var n=this;this._canvasId=e,this._actions=[],L.forEach(function(o){n[o]=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];n._actions.push({method:o,args:e})}})};function D(e){return p(e)?e.apFilePath||e.filePath:""}O.prototype.draw=function(){M("canvas",{canvasId:this._canvasId,actions:this._actions}),this._actions=[]};var R=["play","stop","pause","setSpeed","goToAndStop","goToAndPlay","getDuration","setDirection","playSegments","destroy"],V=["onAnimationEnd","onAnimationRepeat","onDataReady","onDataFailed","onAnimationStart","onAnimationCancel"],j=function(n){var i=this;R.forEach(function(o){i[o]=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];M("lottie",{lottieId:n,action:{method:o,args:e}})}}),V.forEach(function(e){i[e]=function(o){S.on("lottie."+e,function(e){var t=[];e.event&&e.event.args&&(t=e.event.args),e.lottieId===n&&o.apply(i,t)})}})};function U(e){return"/"===e.charAt(0)}function q(e,t){for(var o=t,n=o+1,i=e.length;n<i;o+=1,n+=1)e[o]=e[n];e.pop()}function W(e){return void 0===e&&(e=""),"/"===e[0]?e.slice(1):e}function z(e){return o+JSON.stringify(e.data)}function H(e){return{data:n.test(e.value)?JSON.parse(e.value.substr(o.length)):e.value}}function K(){var e=g();return{model:e.model,pixelRatio:e.pixelRatio,windowWidth:e.screenWidth,windowHeight:e.screenHeight,language:e.language,version:e.appVersion,storage:null,currentBattery:null,system:e.systemVersion,platform:e.platform,screenWidth:e.screenWidth,screenHeight:e.screenHeight,brand:e.brand,fontSizeSetting:14,app:e.appName,SDKVersion:e.version,frameworkType:e.frameworkType,frameworkVersion:e.frameworkVersion,userAgent:e.userAgent,screenDensity:e.screenDensity}}var $=g().version||"";var G=["play","pause","stop","requestFullScreen","exitFullScreen","showControls","hideControls","enableLoop","disableLoop"],J=function(r){var e=this;G.forEach(function(i){e[i]=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var o=v(),n="[[VideoContextAction]]@"+o;m().$emit(n,{action:i,id:r,args:e},o)}})};var Y=new d,X=["onOpen","onError","onMessage","onClose"],Z=0,Q=!1;var ee=Object.freeze({showActionSheet:function(e){this[i]._callModule("actionSheet.showActionSheet",e)},chooseAddress:function(e){this[i]._callModule("address.choose",e)},tradePay:function(e){void 0===e&&(e={}),e=this[i]._preprocess("tradePay",e),this[i]._callModule("alipay.tradePay",e)},createAnimation:function(e){return new B(e)},createInnerAudioContext:function(e){var t=new E(e);return t[i]=this[i],t},getRecorderManager:function(e){return x||((x=new N)[i]=this[i]),x},createCanvasContext:function(e){return new O(e)},openChat:function(e){this[i]._callModule("chat.open",e)},getClipboard:function(e){this[i]._callModule("clipboard.readText",e)},setClipboard:function(e){void 0===e&&(e={}),this[i]._callModule("clipboard.writeText",e,{text:e.text})},getNetworkType:function(e){e=this[i]._preprocess("getNetworkType",e),this[i]._callModule("connection.getType",e,{},function(e){return{networkType:(e.type||"").toUpperCase()}})},onNetworkStatusChange:function(e){F||(F=new d,c("connection").onChange({},function(e){var t=e.type||"";F.emit("networkStatusChange",{networkType:t.toUpperCase()})})),F.on("networkStatusChange",e)},offNetworkStatusChange:function(){F.off("networkStatusChange")},choosePhoneContact:function(e){e=this[i]._preprocess("choosePhoneContact",e),this[i]._callModule("contact.choosePhoneContact",e,{},function(e){return{name:e.name,mobile:e.phone}})},watchShake:function(e){this[i]._callModule("device.onShake",e,{on:!0})},vibrate:function(e){this[i]._callModule("device.vibrate",e)},vibrateShort:function(e){this[i]._callModule("device.vibrateShort",e)},onUserCaptureScreen:function(e){this[i]._callModule("device.onUserCaptureScreen",{success:e})},offUserCaptureScreen:function(){this[i]._callModule("device.offUserCaptureScreen")},scan:function(e){this[i]._callModule("device.scan",e)},saveFile:function(e){return this[i]._callModule("file.saveFile",e,{filePath:D(e)},function(e){return{apFilePath:e.savedFilePath}})},getFileInfo:function(e){return this[i]._callModule("file.getFileInfo",e,{filePath:D(e)},function(e){return{size:e.size}})},getSavedFileInfo:function(e){return this[i]._callModule("file.getFileInfo",e,{filePath:D(e)})},getSavedFileList:function(e){return this[i]._callModule("file.getFileList",e,{},function(e){var t=[];return h(e.fileList)&&(t=e.fileList.map(function(e){return{size:e.size,createTime:e.createTime,apFilePath:e.filePath}})),{fileList:t}})},removeSavedFile:function(e){return this[i]._callModule("file.removeFile",e,{filePath:D(e)})},chooseImage:function(e){this[i]._callModule("image.chooseImage",e)},compressImage:function(e){this[i]._callModule("image.compressImage",e)},previewImage:function(e){this[i]._callModule("image.previewImage",e)},saveImage:function(e){this[i]._callModule("image.saveImage",e)},getImageInfo:function(e){this[i]._callModule("image.getImageInfo",e)},hideKeyboard:function(){this[i]._callModule("keyboard.hideKeyboard")},getLocation:function(e){var o=e.type;this[i]._callModule("location.getLocation",e,e,function(e){var t={longitude:e.coords.longitude,latitude:e.coords.latitude,accuracy:e.coords.accuracy};return 0<o&&e.address&&(t.country=e.address.country,t.province=e.address.province,t.city=e.address.city,t.cityAdcode=e.address.cityCode,t.district=e.address.area,t.districtAdcode=e.address.areaCode),t})},createLottieContext:function(e){return new j(e)},setBackgroundImage:function(e){this[i]._callModule("miniApp.setWebViewBackgroundImage",e)},removeBackgroundImage:function(e){this[i]._callModule("miniApp.setWebViewBackgroundImage",e,{color:"",imgUrl:""})},setViewTop:function(e){this[i]._callModule("miniApp.setWebViewTop",e)},setCanPullDown:function(e){this[i]._callModule("miniApp.setWebViewParams",e)},setShareAppMessage:function(e){void 0===e&&(e={});var t=e.title,o=e.desc,n=e.imageUrl;this[i]._callModule("miniApp.setAppShareInfo",e,{title:t,description:o,imageUrl:n})},pageScrollTo:function(e){void 0===e&&(e={}),M("pageScrollTo",{scrollTop:e.scrollTop})},alert:function(e){void 0===e&&(e={}),this[i]._callModule("modal.alert",e,{title:e.title,message:e.content,okTitle:e.buttonText})},confirm:function(e){void 0===e&&(e={});var t=e.confirmButtonText||"\u786e\u5b9a",o=e.cancelButtonText||"\u53d6\u6d88";this[i]._callModule("modal.confirm",e,{title:e.title,message:e.content,okTitle:t,cancelTitle:o},function(e){return{confirm:e.data===t}})},showToast:function(e){void 0===e&&(e={}),e.duration||(e.duration=2e3),this[i]._callModule("modal.toast",e,{message:e.content,duration:e.duration/1e3})},hideToast:function(e){this[i]._callModule("modal.hideToast",e)},prompt:function(e){this[i]._callModule("modal.prompt",e)},showLoading:function(e){this[i]._callModule("modal.showLoading",e)},hideLoading:function(e){this[i]._callModule("modal.hideLoading",e)},sendMtop:function(e){this[i]._callModule("sendMtop.request",this[i]._preprocess("sendMtop",e))},navigateTo:function(e,t){void 0===e&&(e={}),void 0===t&&(t="");var o=function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"",o=e&&e.split("/")||[],n=t&&t.split("/")||[],i=e&&U(e),r=t&&U(t),a=i||r;if(e&&U(e)?n=o:o.length&&(n.pop(),n=n.concat(o)),!n.length)return"/";var c=void 0;if(n.length){var l=n[n.length-1];c="."===l||".."===l||""===l}else c=!1;for(var s=0,u=n.length;0<=u;u--){var d=n[u];"."===d?q(n,u):".."===d?(q(n,u),s++):s&&(q(n,u),s--)}if(!a)for(;s--;s)n.unshift("..");!a||""===n[0]||n[0]&&U(n[0])||n.unshift("");var f=n.join("/");return c&&"/"!==f.substr(-1)&&(f+="/"),f}((e=this[i]._preprocess("navigateTo",e)).url,t)||"";this[i]._callModule("navigator.push",e,{url:W(o)})},navigateBack:function(e){this[i]._callModule("navigator.pop",this[i]._preprocess("navigateBack",e))},redirectTo:function(e){void 0===e&&(e={}),e=this[i]._preprocess("redirectTo",e),this[i]._callModule("navigator.redirectTo",e,{url:W(e.url)})},switchTab:function(e){void 0===e&&(e={}),e=this[i]._preprocess("switchTab",e),this[i]._callModule("navigator.switchTab",e,{url:W(e.url)})},navigateToMiniProgram:function(e){this[i]._callModule("navigator.navigateToMiniProgram",e)},navigateBackMiniProgram:function(e){this[i]._callModule("navigator.navigateBackMiniProgram",e)},setNavigationBar:function(e){this[i]._callModule("navigatorBar.setNavigationBar",e)},getStatusBarHeight:function(e){this[i]._callModule("navigatorBar.getStatusBarHeight",e,e,function(e){return{height:parseInt(e.data)}})},getNavigationBarHeight:function(e){this[i]._callModule("navigatorBar.getHeight",e,e,function(e){return{height:parseInt(e.data)}})},showNavigationBarLoading:function(e){this[i]._callModule("navigatorBar.showNavigationBarLoading",e)},hideNavigationBarLoading:function(e){this[i]._callModule("navigatorBar.hideNavigationBarLoading",e)},setNavigationBarDrawer:function(e){this[i]._callModule("navigatorBar.setDrawer",e)},openNavigationBarDrawer:function(e){this[i]._callModule("navigatorBar.openDrawer",e)},closeNavigationBarDrawer:function(e){this[i]._callModule("navigatorBar.closeDrawer",e)},setNavigationBarSheet:function(e){this[i]._callModule("navigatorBar.setActionSheet",e)},httpRequest:function(o){void 0===o&&(o={});var e=(o=this[i]._preprocess("httpRequest",o)).method||"GET";if("GET"===e&&p(o.data)){var n=[];Object.keys(o.data).forEach(function(e){var t=o.data[e];n.push(e+"="+JSON.stringify(t))});var t=n.join("&");0<=o.url.indexOf("?")?o.url+=t:o.url+="?"+t}this[i]._callModule("network.request",o,{method:e,url:o.url,headers:o.headers||{"Content-Type":"application/x-www-form-urlencoded"},dataType:o.dataType||"json",body:o.data},function(e){return{data:e.data,status:e.status,headers:e.headers}})},uploadFile:function(e){this[i]._callModule("network.uploadFile",e)},downloadFile:function(e){this[i]._callModule("network.downloadFile",e)},makePhoneCall:function(e){void 0===e&&(e={}),this[i]._callModule("phone.makePhoneCall",e,{phoneNumber:e.number})},chooseCity:function(e){void 0===e&&(e={}),e.cities&&Array.isArray(e.cities)&&(e.cities=e.cities.map(function(e){return{cityName:e.city,cityCode:e.adCode,spell:e.spell}})),e.hotCities&&Array.isArray(e.hotCities)&&(e.hotCities=e.hotCities.map(function(e){return{cityName:e.city,cityCode:e.adCode,spell:e.spell}})),this[i]._callModule("picker.chooseCity",e,e,function(e){return{city:e.cityName,adCode:e.cityCode}})},datePicker:function(e){void 0===e&&(e={}),this[i]._callModule("picker.pickDate",e,{format:e.format,value:e.currentDate,min:e.startDate,max:e.endDate},function(e){return{date:e.data}})},setScreenBrightness:function(e){void 0===e&&(e={}),this[i]._callModule("screen.setBrightness",e,{brightness:e.brightness})},getScreenBrightness:function(e){this[i]._callModule("screen.getScreenBrightness",e,e,function(e){return{brightness:e.value}})},setKeepScreenOn:function(e){void 0===e&&(e={}),this[i]._callModule("screen.setAlwaysOn",e,{on:e.keepScreenOn})},shareTinyAppMsg:function(e){this[i]._callModule("share.doShare",e)},showSku:function(e){this[i]._callModule("sku.show",e)},hideSku:function(e){this[i]._callModule("sku.hide",e)},setStorage:function(e){void 0===e&&(e={}),this[i]._callModule("storage.setItem",e,{key:e.key,value:z(e)})},setStorageSync:function(e){return this[i]._callModuleSync("storage.setItemSync",{key:e.key,value:z(e)})},getStorage:function(e){void 0===e&&(e={}),this[i]._callModule("storage.getItem",e,e,H)},getStorageSync:function(e){return H(this[i]._callModuleSync("storage.getItemSync",e))},removeStorage:function(e){void 0===e&&(e={}),this[i]._callModule("storage.removeItem",e)},removeStorageSync:function(e){return void 0===e&&(e={}),this[i]._callModuleSync("storage.removeItemSync",e)},clearStorage:function(e){this[i]._callModule("storage.clearStorage",e)},clearStorageSync:function(e){return this[i]._callModuleSync("storage.clearStorageSync",e)},getStorageInfo:function(e){this[i]._callModule("storage.getStorageInfo",e)},getStorageInfoSync:function(e){return this[i]._callModuleSync("storage.getStorageInfoSync",e)},getSystemInfoSync:K,getSystemInfo:function(t){void 0===t&&(t={});try{"function"==typeof t.success&&t.success.call(this,K())}catch(e){"function"==typeof t.fail&&t.fail.call(this,e)}finally{"function"==typeof t.complete&&t.complete.call(this)}},SDKVersion:$,showTabBar:function(e){this[i]._callModule("tabBar.show",e)},hideTabBar:function(e){this[i]._callModule("tabBar.hide",e)},setTabBarStyle:function(e){this[i]._callModule("tabBar.setTabBarStyle",e)},setTabBarItem:function(e){this[i]._callModule("tabBar.setTabBarItem",e)},setTabBarBadge:function(e){this[i]._callModule("tabBar.setTabBarBadge",e)},removeTabBarBadge:function(e){this[i]._callModule("tabBar.removeTabBarBadge",e)},showTabBarRedDot:function(e){this[i]._callModule("tabBar.showTabBarRedDot",e)},hideTabBarRedDot:function(e){this[i]._callModule("tabBar.hideTabBarRedDot",e)},uccBind:function(e){this[i]._callModule("ucc.uccBind",e)},uccTrustLogin:function(e){this[i]._callModule("ucc.uccTrustLogin",e)},uccUnbind:function(e){this[i]._callModule("ucc.uccUnbind",e)},reportAnalytics:function(e,t){void 0===t&&(t={}),"click"==e||"enter"==e||"expose"==e?I("userTrack.commitut")({type:e,eventId:t.eventId,name:t.name,comName:t.comName,arg1:t.arg1,arg2:t.arg2,arg3:t.arg3,param:t.param}):I("userTrack.customAdvance")({eventId:t.eventId,name:t.name,comName:t.comName,arg1:t.arg1,arg2:t.arg2,arg3:t.arg3,param:t.param})},createVideoContext:function(e){return new J(e)},chooseVideo:function(e){this[i]._callModule("video.chooseVideo",e,e,function(e){return e.apFilePath&&(e.tempFilePath=e.apFilePath,delete e.apFilePath),e})},saveVideoToPhotosAlbum:function(e){this[i]._callModule("video.saveVideoToPhotosAlbum",e)},getAuthUserInfo:function(e){this[i]._callModule("sendMtop.request",e,{api:"mtop.taobao.openlink.openinfo.user.get",v:"1.0",type:"GET"},function(e){var t={nickName:e.data.mixNick,userId:e.data.openId};return e.data.avatar&&(t.avatar=e.data.avatar),e.data.unionId&&(t.unionId=e.data.unionId),t})},getTBCode:function(e){this[i]._callModule("sendMtop.request",e,{api:"mtop.taobao.openlink.basic.login.auth.code",v:"1.0",type:"GET"},function(e){return{code:e.data.result}})},getTBSessionInfo:function(e){this[i]._callModule("wopc.getSessionKey",e,e,function(e){return{data:e}})},setTBSessionInfo:function(e){void 0===e&&(e={}),this[i]._callModule("wopc.setSessionKey",e,e.sessionInfo,function(e){return{success:!0}})},getSetting:function(e){this[i]._callModule("wopc.getSetting",e)},openSetting:function(e){this[i]._callModule("wopc.openSetting",e)},authorize:function(e){this[i]._callModule("wopc.authorize",e)},connectSocket:function(e){var o=this;void 0===e&&(e={}),Q&&(this[i]._callModule("webSocket.close",{instanceId:Z}),Q=!1,Z++),this[i]._callModule("webSocket.webSocket",e,{instanceId:Z,url:e.url,protocol:""},function(e){return Q=!0,e}),X.forEach(function(t){o[i]._callModule("webSocket."+t,{instanceId:Z,success:function(e){Y.emit(t,e)}})})},sendSocketMessage:function(e){void 0===e&&(e={}),this[i]._callModule("webSocket.send",e,{instanceId:Z,data:e.data})},closeSocket:function(e){this[i]._callModule("webSocket.close",e,{instanceId:Z},function(e){return Q=!1,Z++,e})},onSocketOpen:function(e){Y.on("onOpen",e)},offSocketOpen:function(e){Y.off("onOpen",e)},onSocketError:function(e){Y.on("onError",e)},offSocketError:function(e){Y.off("onError",e)},onSocketMessage:function(t){Y.on("onMessage",function(e){t&&t({data:e,isBuffer:!1})})},offSocketMessage:function(e){Y.off("onMessage",e)},onSocketClose:function(e){Y.on("onClose",e)},offSocketClose:function(e){Y.off("onClose",e)}}),te=function(o){function e(e){void 0===e&&(e={});var t=Object.assign({},ee,{canIUse:function(e){return e in ee}});o.call(this,e,t),m().$on("[[ModuleAPIEvent]]",function(e){var t=e.type;void 0===t&&(t="");var o=e.data;void 0===o&&(o={});var n=t;o.event&&o.event.name&&(n+="."+o.event.name),S.emit(n,o)})}return o&&(e.__proto__=o),(e.prototype=Object.create(o&&o.prototype)).constructor=e}(e);function oe(e){var t,o="my";e&&e.defaultName&&(o=e.defaultName);var n=new te(e).createContext();return(t={})[o]=n,t}return function(t,o,e){void 0===e&&(e=!0);var n=r();try{Object.defineProperty(n,t,{value:o,configurable:!0,enumerable:!0,writable:!e})}catch(e){n[t]=o}}("__WINDMILL_MODULE_API__",{getAPIs:oe}),oe});
{
"name": "windmill-module-api",
"version": "0.2.58",
"version": "0.2.59",
"description": "Standard module APIs of windmill.",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc