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.55 to 0.2.56

221

index.js

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

/* windmill-module-api (0.2.55), build at 2018-11-30 17:04. */
/* windmill-module-api (0.2.56), build at 2018-12-05 15:49. */

@@ -49,2 +49,71 @@ (function (global, factory) {

/**
* Event Emitter
* Partially implement the events module of Node.js.
* https://nodejs.org/api/events.html#events_class_eventemitter
*/
var eventMapKey = '[[EVENT_MAP]]';
function initListeners(emitter, eventName) {
var events = emitter[eventMapKey];
if (!Array.isArray(events[eventName])) {
events[eventName] = [];
}
return events[eventName];
}
var EventEmitter = function EventEmitter() {
Object.defineProperty(this, eventMapKey, {
configurable: false,
enumerable: false,
writable: false,
value: {}
});
};
EventEmitter.prototype.on = function on (eventName, listener) {
var listeners = initListeners(this, eventName);
listeners.push({ listener: listener, once: false, callCount: 0 });
return this;
};
EventEmitter.prototype.once = function once (eventName, listener) {
var listeners = initListeners(this, eventName);
listeners.push({ listener: listener, once: true, callCount: 0 });
return this;
};
EventEmitter.prototype.off = function off (eventName, listener) {
var events = this[eventMapKey];
if (listener) {
var listeners = events[eventName];
if (Array.isArray(listeners)) {
var index = listeners.findIndex(function (x) { return x.listener === listener; });
if (index !== -1) {
listeners.splice(index, 1);
}
}
}
else {
delete events[eventName];
}
return this;
};
EventEmitter.prototype.emit = function emit (eventName) {
var args = [], len = arguments.length - 1;
while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
var events = this[eventMapKey];
var listeners = events[eventName];
if (Array.isArray(listeners)) {
// invoke event listeners
events[eventName] = listeners.filter(function (desc) {
try {
desc.listener.apply(null, args);
desc.callCount += 1;
}
catch (e) {
return true;
}
return !desc.once;
});
}
return this;
};
function hasOwn(object, key) {

@@ -130,3 +199,20 @@ return Object.prototype.hasOwnProperty.call(object, key);

}
var renderEventEmitter = new EventEmitter();
/**
* 监听来自 render 的事件
*/
function listenModuleAPIEvent() {
var eventName = '[[ModuleAPIEvent]]';
getRuntime().$on(eventName, function (ref) {
var type = ref.type; if ( type === void 0 ) type = '';
var data = ref.data; if ( data === void 0 ) data = {};
var name = type;
if (data.event && data.event.name) {
name += "." + (data.event.name);
}
renderEventEmitter.emit(name, data);
});
}
/**
* Set a global API to current context

@@ -341,71 +427,2 @@ */

/**
* Event Emitter
* Partially implement the events module of Node.js.
* https://nodejs.org/api/events.html#events_class_eventemitter
*/
var eventMapKey = '[[EVENT_MAP]]';
function initListeners(emitter, eventName) {
var events = emitter[eventMapKey];
if (!Array.isArray(events[eventName])) {
events[eventName] = [];
}
return events[eventName];
}
var EventEmitter = function EventEmitter() {
Object.defineProperty(this, eventMapKey, {
configurable: false,
enumerable: false,
writable: false,
value: {}
});
};
EventEmitter.prototype.on = function on (eventName, listener) {
var listeners = initListeners(this, eventName);
listeners.push({ listener: listener, once: false, callCount: 0 });
return this;
};
EventEmitter.prototype.once = function once (eventName, listener) {
var listeners = initListeners(this, eventName);
listeners.push({ listener: listener, once: true, callCount: 0 });
return this;
};
EventEmitter.prototype.off = function off (eventName, listener) {
var events = this[eventMapKey];
if (listener) {
var listeners = events[eventName];
if (Array.isArray(listeners)) {
var index = listeners.findIndex(function (x) { return x.listener === listener; });
if (index !== -1) {
listeners.splice(index, 1);
}
}
}
else {
delete events[eventName];
}
return this;
};
EventEmitter.prototype.emit = function emit (eventName) {
var args = [], len = arguments.length - 1;
while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
var events = this[eventMapKey];
var listeners = events[eventName];
if (Array.isArray(listeners)) {
// invoke event listeners
events[eventName] = listeners.filter(function (desc) {
try {
desc.listener.apply(null, args);
desc.callCount += 1;
}
catch (e) {
return true;
}
return !desc.once;
});
}
return this;
};
var InnerAudioConext = function InnerAudioConext(options) {

@@ -690,2 +707,5 @@ if ( options === void 0 ) options = {};

}
function scan(options) {
callModule('device.scan', options);
}

@@ -779,2 +799,42 @@ /**

var ACTION_LIST$2 = ['play', 'stop', 'pause', 'setSpeed', 'goToAndStop',
'goToAndPlay', 'getDuration', 'setDirection', 'playSegments', 'destroy'];
var EVENT_LIST = ['onAnimationEnd', 'onAnimationRepeat', 'onDataReady',
'onDataFailed', 'onAnimationStart', 'onAnimationCancel'];
var LottieContext = function LottieContext(id) {
var this$1 = this;
ACTION_LIST$2.forEach(function (action) {
this$1[action] = function () {
var args = [], len = arguments.length;
while ( len-- ) args[ len ] = arguments[ len ];
emitModuleAPIEvent('lottie', {
lottieId: id,
action: {
method: action,
args: args
}
});
};
});
EVENT_LIST.forEach(function (event) {
this$1[event] = function (callback) {
renderEventEmitter.on(("lottie." + event), function (data) {
var args = [];
if (data.event && data.event.args) {
args = data.event.args;
}
if (data.lottieId === id) {
callback.apply(this$1, args);
}
});
};
});
};
function createLottieContext(id) {
return new LottieContext(id);
}
function setBackgroundImage(options) {

@@ -1095,3 +1155,3 @@ callModule('miniApp.setWebViewBackgroundImage', options);

callModule('picker.pickDate', options, {
// format: options.format, // not support yet
format: options.format,
value: options.currentDate,

@@ -1312,3 +1372,3 @@ min: options.startDate,

var ACTION_LIST$2 = ['play', 'pause', 'stop', 'requestFullScreen', 'exitFullScreen',
var ACTION_LIST$3 = ['play', 'pause', 'stop', 'requestFullScreen', 'exitFullScreen',
'showControls', 'hideControls', 'enableLoop', 'disableLoop'];

@@ -1318,3 +1378,3 @@ var VideoContext = function VideoContext(id) {

ACTION_LIST$2.forEach(function (action) {
ACTION_LIST$3.forEach(function (action) {
this$1[action] = function () {

@@ -1348,3 +1408,3 @@ var args = [], len = arguments.length;

function getAuthUserInfo(options) {
callModule('WopcMtopPlugin.request', options, {
callModule('sendMtop.request', options, {
api: 'mtop.taobao.openlink.openinfo.user.get',

@@ -1368,3 +1428,11 @@ v: '1.0',

function getTBCode(options) {
callModule('wopc.authLogin', options);
callModule('sendMtop.request', options, {
api: 'mtop.taobao.openlink.basic.login.auth.code',
v: '1.0',
type: 'GET'
}, function (res) {
return {
code: res.data.result
};
});
}

@@ -1483,2 +1551,3 @@ function getTBSessionInfo(options) {

offUserCaptureScreen: offUserCaptureScreen,
scan: scan,
saveFile: saveFile,

@@ -1496,2 +1565,3 @@ getFileInfo: getFileInfo,

getLocation: getLocation,
createLottieContext: createLottieContext,
setBackgroundImage: setBackgroundImage,

@@ -1629,2 +1699,3 @@ removeBackgroundImage: removeBackgroundImage,

registerModuleApi(my);
listenModuleAPIEvent();
if (options && options.preprocessor) {

@@ -1631,0 +1702,0 @@ registerPreprocessor(my, options.preprocessor);

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

/* windmill-module-api (0.2.55), build at 2018-11-30 17:04. */
!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__",n="[[JSON]]",o=/^\[\[JSON\]\].*/;function r(){return"undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:new Function("return this")()}var i,a="__WINDMILL_MODULE_GETTER__";function c(t){var e=r();return e&&"function"==typeof e[a]?e[a](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)}function u(t){return Object.prototype.toString.call(t).slice(8,-1)}function s(t){return"Object"===u(t)}function f(t){return"Array"===u(t)}function d(){return"object"==typeof __windmill_environment__?__windmill_environment__:"object"==typeof wmlEnv?wmlEnv:"object"==typeof windmillEnv?windmillEnv:{}}function l(){if(!i){var t=r();i=t[e]}return i}function p(){return l().$getCurrentActivePageId()}var g={};function h(t,e){var n=g[t];return"function"==typeof n&&s(e)?n(e):e}var m,v=(m=1e5,function(){var t=String(m);return m+=1,t});function y(t,e){var n=p(),o="[[ModuleAPIEvent]]@"+n;l().$emit(o,{type:t,data:e},n)}var S=["success","fail","complete"];function w(t){var e={};for(var n in t)-1===S.indexOf(n)&&(e[n]=t[n]);return e}function b(n,t){var o=l();if(o){if(t&&"function"==typeof o.$callSync)return function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return o.$callSync.apply(o,[n].concat(t))};if(!t&&"function"==typeof o.$call)return function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return o.$call.apply(o,[n].concat(t))}}var e=n.split(/\s*\.\s*/i),r=e[0],i=e[1];if(r&&i){var a=c(r);if(a&&"function"==typeof a[i])return a[i]}return function(){}}function I(t,e){if("function"==typeof t)try{return t.apply(null,e)}catch(t){console.error("Failed to execute internal method: "+t.toString())}}var T=function(t,e){console.error('Failed to execute callback of "'+t+'": '+e.toString())};function k(e,t,n){if("function"==typeof t)try{return t.apply(null,n)}catch(t){T(e,t)}}function _(n,o,t,r,i){void 0===o&&(o={}),void 0===t&&(t=o),void 0===r&&(r=function(t){return t}),void 0===i&&(i=function(t){return t});var e=b(n),a=!1;return e(w(t),function(t){var e=I(r,[t]);k(n,o.success,[e]),a||(k(n,o.complete,[e]),a=!0)},function(t){var e=I(i,[t]);k(n,o.fail,[e]),a||(k(n,o.complete,[e]),a=!0)})}function B(t,e){return void 0===e&&(e={}),b(t,!0)(w(e))}var t=["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 o=this;this.animations=[],this.currentAnimation=[],this.config={},t.forEach(function(n){o[n]=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return o.currentAnimation.push([n,t]),o}})};C.prototype.step=function(t){return this.animations.push({config:Object.assign({},this.config,t),animation:this.currentAnimation}),this.currentAnimation=[],this},C.prototype.export=function(){var t=this.animations;return this.animations=[],t};var P=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}(C);var A="[[EVENT_MAP]]";function N(t,e){var n=t[A];return Array.isArray(n[e])||(n[e]=[]),n[e]}var x=function(){Object.defineProperty(this,A,{configurable:!1,enumerable:!1,writable:!1,value:{}})};x.prototype.on=function(t,e){return N(this,t).push({listener:e,once:!1,callCount:0}),this},x.prototype.once=function(t,e){return N(this,t).push({listener:e,once:!0,callCount:0}),this},x.prototype.off=function(t,e){var n=this[A];if(e){var o=n[t];if(Array.isArray(o)){var r=o.findIndex(function(t){return t.listener===e});-1!==r&&o.splice(r,1)}}else delete n[t];return this},x.prototype.emit=function(t){for(var e=[],n=arguments.length-1;0<n--;)e[n]=arguments[n+1];var o=this[A],r=o[t];return Array.isArray(r)&&(o[t]=r.filter(function(t){try{t.listener.apply(null,e),t.callCount+=1}catch(t){return!0}return!t.once})),this};var E=function(t){void 0===t&&(t={}),this._instanceId=v(),this._emitter=new x,this.src=t.src};E.prototype.play=function(t){var e=this;_("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})},E.prototype.pause=function(t){var e=this;_("audioPlayer.pauseVoice",t,{instanceId:this._instanceId},function(t){return e._emitter.emit("pause"),t},function(t){return e._emitter.emit("error",t),t})},E.prototype.stop=function(t){var e=this;_("audioPlayer.stopVoice",t,{instanceId:this._instanceId},function(t){return e._emitter.emit("stop"),t},function(t){return e._emitter.emit("error",t),t})},E.prototype.onPlay=function(t){this._emitter.on("play",t)},E.prototype.onPause=function(t){this._emitter.on("pause",t)},E.prototype.onStop=function(t){this._emitter.on("stop",t)},E.prototype.onError=function(t){this._emitter.on("error",t)},E.prototype.offPlay=function(t){this._emitter.off("play",t)},E.prototype.offPause=function(t){this._emitter.off("pause",t)},E.prototype.offStop=function(t){this._emitter.off("stop",t)},E.prototype.offError=function(t){this._emitter.off("error",t)};var F,M=function(){this._startEmitted=!1,this._emitter=new x};M.prototype.start=function(t){var e=this;void 0===t&&(t={}),this._startEmitted=!1,_("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})},M.prototype.stop=function(t){var e=this;void 0===t&&(t={}),_("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})},M.prototype.onStart=function(t){this._emitter.on("start",t)},M.prototype.onStop=function(t){this._emitter.on("stop",t)},M.prototype.onError=function(t){this._emitter.on("error",t)},M.prototype.offStart=function(t){this._emitter.off("start",t)},M.prototype.offStop=function(t){this._emitter.off("stop",t)},M.prototype.offError=function(t){this._emitter.off("error",t)};var L,O=["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"],D=function(t){var o=this;this._canvasId=t,this._actions=[],O.forEach(function(n){o[n]=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];o._actions.push({method:n,args:t})}})};function V(t){return s(t)?t.apFilePath||t.filePath:""}function R(t){return"/"===t.charAt(0)}function j(t,e){for(var n=e,o=n+1,r=t.length;o<r;n+=1,o+=1)t[n]=t[o];t.pop()}function U(t){return void 0===t&&(t=""),"/"===t[0]?t.slice(1):t}function q(t){return n+JSON.stringify(t.data)}function W(t){return{data:o.test(t.value)?JSON.parse(t.value.substr(n.length)):t.value}}function H(){var t=d();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}}D.prototype.draw=function(){y("canvas",{canvasId:this._canvasId,actions:this._actions}),this._actions=[]};var z=d().version||"";var K=["play","pause","stop","requestFullScreen","exitFullScreen","showControls","hideControls","enableLoop","disableLoop"],$=function(i){var t=this;K.forEach(function(r){t[r]=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var n=p(),o="[[VideoContextAction]]@"+n;l().$emit(o,{action:r,id:i,args:t},n)}})};var G=new x,J=["onOpen","onError","onMessage","onClose"],X=0,Y=!1;var Z=Object.freeze({showActionSheet:function(t){_("actionSheet.showActionSheet",t)},chooseAddress:function(t){_("address.chooseAddress",t)},tradePay:function(t){void 0===t&&(t={}),_("alipay.tradePay",t=h("tradePay",t))},createAnimation:function(t){return new P(t)},createInnerAudioContext:function(t){return new E(t)},getRecorderManager:function(t){return F||(F=new M),F},createCanvasContext:function(t){return new D(t)},openChat:function(t){_("chat.open",t)},getClipboard:function(t){_("clipboard.readText",t)},setClipboard:function(t){void 0===t&&(t={}),_("clipboard.writeText",t,{text:t.text})},getNetworkType:function(t){_("connection.getType",t=h("getNetworkType",t),{},function(t){return{networkType:(t.type||"").toUpperCase()}})},onNetworkStatusChange:function(t){L||(L=new x,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){_("contact.choosePhoneContact",t=h("choosePhoneContact",t),{},function(t){return{name:t.name,mobile:t.phone}})},watchShake:function(t){_("device.onShake",t,{on:!0})},vibrate:function(t){_("device.vibrate",t)},vibrateShort:function(t){_("device.vibrateShort",t)},onUserCaptureScreen:function(t){_("device.onUserCaptureScreen",{success:t})},offUserCaptureScreen:function(){_("device.offUserCaptureScreen")},saveFile:function(t){return _("file.saveFile",t,{filePath:V(t)},function(t){return{apFilePath:t.savedFilePath}})},getFileInfo:function(t){return _("file.getFileInfo",t,{filePath:V(t)},function(t){return{size:t.size}})},getSavedFileInfo:function(t){return _("file.getFileInfo",t,{filePath:V(t)})},getSavedFileList:function(t){return _("file.getFileList",t,{},function(t){var e=[];return f(t.fileList)&&(e=t.fileList.map(function(t){return{size:t.size,createTime:t.createTime,apFilePath:t.filePath}})),{fileList:e}})},removeSavedFile:function(t){return _("file.removeFile",t,{filePath:V(t)})},chooseImage:function(t){_("image.chooseImage",t)},compressImage:function(t){_("image.compressImage",t)},previewImage:function(t){_("image.previewImage",t)},saveImage:function(t){_("image.saveImage",t)},getImageInfo:function(t){_("image.getImageInfo",t)},hideKeyboard:function(){_("keyboard.hideKeyboard")},getLocation:function(t){var n=t.type;_("location.getLocation",t,t,function(t){var e={longitude:t.coords.longitude,latitude:t.coords.latitude,accuracy:t.coords.accuracy};return 0<n&&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})},setBackgroundImage:function(t){_("miniApp.setWebViewBackgroundImage",t)},removeBackgroundImage:function(t){_("miniApp.setWebViewBackgroundImage",t,{color:"",imgUrl:""})},setViewTop:function(t){_("miniApp.setWebViewTop",t)},setCanPullDown:function(t){_("miniApp.setWebViewParams",t)},setShareAppMessage:function(t){void 0===t&&(t={}),_("miniApp.setAppShareInfo",t,{title:t.title,description:t.desc,imageUrl:t.imageUrl})},pageScrollTo:function(t){void 0===t&&(t={}),y("pageScrollTo",{scrollTop:t.scrollTop})},alert:function(t){void 0===t&&(t={}),_("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",n=t.cancelButtonText||"\u53d6\u6d88";_("modal.confirm",t,{title:t.title,message:t.content,okTitle:e,cancelTitle:n},function(t){return{confirm:t.data===e}})},showToast:function(t){void 0===t&&(t={}),t.duration||(t.duration=2e3),_("modal.toast",t,{message:t.content,duration:t.duration/1e3})},hideToast:function(t){_("modal.hideToast",t)},prompt:function(t){_("modal.prompt",t)},showLoading:function(t){_("modal.showLoading",t)},hideLoading:function(t){_("modal.hideLoading",t)},sendMtop:function(t){_("sendMtop.request",h("sendMtop",t))},navigateTo:function(t,e){void 0===t&&(t={}),void 0===e&&(e=""),_("navigator.push",t=h("navigateTo",t),{url:U(function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"",n=t&&t.split("/")||[],o=e&&e.split("/")||[],r=t&&R(t),i=e&&R(e),a=r||i;if(t&&R(t)?o=n:n.length&&(o.pop(),o=o.concat(n)),!o.length)return"/";var c=void 0;if(o.length){var u=o[o.length-1];c="."===u||".."===u||""===u}else c=!1;for(var s=0,f=o.length;0<=f;f--){var d=o[f];"."===d?j(o,f):".."===d?(j(o,f),s++):s&&(j(o,f),s--)}if(!a)for(;s--;s)o.unshift("..");!a||""===o[0]||o[0]&&R(o[0])||o.unshift("");var l=o.join("/");return c&&"/"!==l.substr(-1)&&(l+="/"),l}(t.url,e)||"")})},navigateBack:function(t){_("navigator.pop",h("navigateBack",t))},redirectTo:function(t){void 0===t&&(t={}),_("navigator.redirectTo",t=h("redirectTo",t),{url:U(t.url)})},switchTab:function(t){void 0===t&&(t={}),_("navigator.switchTab",t=h("switchTab",t),{url:U(t.url)})},navigateToMiniProgram:function(t){_("navigator.navigateToMiniProgram",t)},navigateBackMiniProgram:function(t){_("navigator.navigateBackMiniProgram",t)},setNavigationBar:function(t){_("navigatorBar.setNavigationBar",t)},getStatusBarHeight:function(t){_("navigatorBar.getStatusBarHeight",t,t,function(t){return{height:parseInt(t.data)}})},getNavigationBarHeight:function(t){_("navigatorBar.getHeight",t,t,function(t){return{height:parseInt(t.data)}})},showNavigationBarLoading:function(t){_("navigatorBar.showNavigationBarLoading",t)},hideNavigationBarLoading:function(t){_("navigatorBar.hideNavigationBarLoading",t)},setNavigationBarDrawer:function(t){_("navigatorBar.setDrawer",t)},openNavigationBarDrawer:function(t){_("navigatorBar.openDrawer",t)},closeNavigationBarDrawer:function(t){_("navigatorBar.closeDrawer",t)},setNavigationBarSheet:function(t){_("navigatorBar.setActionSheet",t)},httpRequest:function(n){void 0===n&&(n={});var t=(n=h("httpRequest",n)).method||"GET";if("GET"===t&&s(n.data)){var o=[];Object.keys(n.data).forEach(function(t){var e=n.data[t];o.push(t+"="+JSON.stringify(e))});var e=o.join("&");0<=n.url.indexOf("?")?n.url+=e:n.url+="?"+e}_("network.request",n,{method:t,url:n.url,headers:n.headers||{"Content-Type":"application/x-www-form-urlencoded"},dataType:n.dataType||"json",body:n.data},function(t){return{data:t.data,status:t.status,headers:t.headers}})},uploadFile:function(t){_("network.uploadFile",t)},downloadFile:function(t){_("network.downloadFile",t)},makePhoneCall:function(t){void 0===t&&(t={}),_("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}})),_("picker.chooseCity",t,t,function(t){return{city:t.cityName,adCode:t.cityCode}})},datePicker:function(t){void 0===t&&(t={}),_("picker.pickDate",t,{value:t.currentDate,min:t.startDate,max:t.endDate},function(t){return{date:t.data}})},setScreenBrightness:function(t){void 0===t&&(t={}),_("screen.setBrightness",t,{brightness:t.brightness})},getScreenBrightness:function(t){_("screen.getScreenBrightness",t,t,function(t){return{brightness:t.value}})},setKeepScreenOn:function(t){void 0===t&&(t={}),_("screen.setAlwaysOn",t,{on:t.keepScreenOn})},shareTinyAppMsg:function(t){_("share.doShare",t)},showSku:function(t){_("sku.show",t)},hideSku:function(t){_("sku.hide",t)},setStorage:function(t){void 0===t&&(t={}),_("storage.setItem",t,{key:t.key,value:q(t)})},setStorageSync:function(t){return B("storage.setItemSync",{key:t.key,value:q(t)})},getStorage:function(t){void 0===t&&(t={}),_("storage.getItem",t,t,W)},getStorageSync:function(t){return W(B("storage.getItemSync",t))},removeStorage:function(t){void 0===t&&(t={}),_("storage.removeItem",t)},removeStorageSync:function(t){return void 0===t&&(t={}),B("storage.removeItemSync",t)},clearStorage:function(t){_("storage.clearStorage",t)},clearStorageSync:function(t){return B("storage.clearStorageSync",t)},getStorageInfo:function(t){_("storage.getStorageInfo",t)},getStorageInfoSync:function(t){return B("storage.getStorageInfoSync",t)},getSystemInfoSync:H,getSystemInfo:function(e){void 0===e&&(e={});try{"function"==typeof e.success&&e.success.call(this,H())}catch(t){"function"==typeof e.fail&&e.fail.call(this,t)}finally{"function"==typeof e.complete&&e.complete.call(this)}},SDKVersion:z,showTabBar:function(t){_("tabBar.show",t)},hideTabBar:function(t){_("tabBar.hide",t)},setTabBarStyle:function(t){_("tabBar.setTabBarStyle",t)},setTabBarItem:function(t){_("tabBar.setTabBarItem",t)},setTabBarBadge:function(t){_("tabBar.setTabBarBadge",t)},removeTabBarBadge:function(t){_("tabBar.removeTabBarBadge",t)},showTabBarRedDot:function(t){_("tabBar.showTabBarRedDot",t)},hideTabBarRedDot:function(t){_("tabBar.hideTabBarRedDot",t)},uccBind:function(t){_("ucc.uccBind",t)},uccTrustLogin:function(t){_("ucc.uccTrustLogin",t)},uccUnbind:function(t){_("ucc.uccUnbind",t)},reportAnalytics:function(t,e){void 0===e&&(e={}),"click"==t||"enter"==t||"expose"==t?b("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}):b("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 $(t)},chooseVideo:function(t){_("video.chooseVideo",t,t,function(t){return t.apFilePath&&(t.tempFilePath=t.apFilePath,delete t.apFilePath),t})},saveVideoToPhotosAlbum:function(t){_("video.saveVideoToPhotosAlbum",t)},getAuthUserInfo:function(t){_("WopcMtopPlugin.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){_("wopc.authLogin",t)},getTBSessionInfo:function(t){_("wopc.getSessionKey",t,t,function(t){return{data:t}})},setTBSessionInfo:function(t){void 0===t&&(t={}),_("wopc.setSessionKey",t,t.sessionInfo,function(t){return{success:!0}})},connectSocket:function(t){void 0===t&&(t={}),Y&&(_("webSocket.close",{instanceId:X}),Y=!1,X++),_("webSocket.webSocket",t,{instanceId:X,url:t.url,protocol:""},function(t){return Y=!0,t}),J.forEach(function(e){_("webSocket."+e,{instanceId:X,success:function(t){G.emit(e,t)}})})},sendSocketMessage:function(t){void 0===t&&(t={}),_("webSocket.send",t,{instanceId:X,data:t.data})},closeSocket:function(t){_("webSocket.close",t,{instanceId:X},function(t){return Y=!1,X++,t})},onSocketOpen:function(t){G.on("onOpen",t)},offSocketOpen:function(t){G.off("onOpen",t)},onSocketError:function(t){G.on("onError",t)},offSocketError:function(t){G.off("onError",t)},onSocketMessage:function(e){G.on("onMessage",function(t){e&&e({data:t,isBuffer:!1})})},offSocketMessage:function(t){G.off("onMessage",t)},onSocketClose:function(t){G.on("onClose",t)},offSocketClose:function(t){G.off("onClose",t)}});function Q(t){var e,n="my";t&&t.defaultName&&(n=t.defaultName);var r,o,i,a=Object.assign({},Z,{canIUse:function(t){return t in Z}});return r=a,(o=l())&&o.$on("registerModuleAPI",function(t){var e=t.data,n=e.scope;if(n)if(f(e.map))if(!r[n]||s(r[n])){var o=r[n]=r[n]||{};e.map.forEach(function(e){o[e.apiName]&&console.warn("my."+n+"."+e.apiName+" is already existed and will be overridded."),o[e.apiName]=function(t){return e.isSync?B(e.moduleMethod,t):_(e.moduleMethod,t)}})}else console.error('"my.'+n+"\" 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&&t.preprocessor&&function(t,e){if(s(t)&&s(e))for(var n in e)o=t,r=n,Object.prototype.hasOwnProperty.call(o,r)&&"function"==typeof e[n]&&(g[n]=e[n]);var o,r}(a,t.preprocessor),t&&t.errorHandler&&"function"==typeof(i=t.errorHandler)&&(T=i),(e={})[n]=a,e}return function(e,n,t){void 0===t&&(t=!0);var o=r();try{Object.defineProperty(o,e,{value:n,configurable:!0,enumerable:!0,writable:!t})}catch(t){o[e]=n}}("__WINDMILL_MODULE_API__",{getAPIs:Q}),Q});
/* windmill-module-api (0.2.56), build at 2018-12-05 15:49. */
!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__",n="[[JSON]]",o=/^\[\[JSON\]\].*/;function r(){return"undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:new Function("return this")()}var i="__WINDMILL_MODULE_GETTER__";function c(t){var e=r();return e&&"function"==typeof e[i]?e[i](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 a="[[EVENT_MAP]]";function u(t,e){var n=t[a];return Array.isArray(n[e])||(n[e]=[]),n[e]}var s,f=function(){Object.defineProperty(this,a,{configurable:!1,enumerable:!1,writable:!1,value:{}})};function d(t){return Object.prototype.toString.call(t).slice(8,-1)}function l(t){return"Object"===d(t)}function p(t){return"Array"===d(t)}function g(){return"object"==typeof __windmill_environment__?__windmill_environment__:"object"==typeof wmlEnv?wmlEnv:"object"==typeof windmillEnv?windmillEnv:{}}function h(){if(!s){var t=r();s=t[e]}return s}function m(){return h().$getCurrentActivePageId()}f.prototype.on=function(t,e){return u(this,t).push({listener:e,once:!1,callCount:0}),this},f.prototype.once=function(t,e){return u(this,t).push({listener:e,once:!0,callCount:0}),this},f.prototype.off=function(t,e){var n=this[a];if(e){var o=n[t];if(Array.isArray(o)){var r=o.findIndex(function(t){return t.listener===e});-1!==r&&o.splice(r,1)}}else delete n[t];return this},f.prototype.emit=function(t){for(var e=[],n=arguments.length-1;0<n--;)e[n]=arguments[n+1];var o=this[a],r=o[t];return Array.isArray(r)&&(o[t]=r.filter(function(t){try{t.listener.apply(null,e),t.callCount+=1}catch(t){return!0}return!t.once})),this};var v={};function y(t,e){var n=v[t];return"function"==typeof n&&l(e)?n(e):e}var S,w=(S=1e5,function(){var t=String(S);return S+=1,t});function b(t,e){var n=m(),o="[[ModuleAPIEvent]]@"+n;h().$emit(o,{type:t,data:e},n)}var I=new f;var T=["success","fail","complete"];function k(t){var e={};for(var n in t)-1===T.indexOf(n)&&(e[n]=t[n]);return e}function _(n,t){var o=h();if(o){if(t&&"function"==typeof o.$callSync)return function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return o.$callSync.apply(o,[n].concat(t))};if(!t&&"function"==typeof o.$call)return function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return o.$call.apply(o,[n].concat(t))}}var e=n.split(/\s*\.\s*/i),r=e[0],i=e[1];if(r&&i){var a=c(r);if(a&&"function"==typeof a[i])return a[i]}return function(){}}function B(t,e){if("function"==typeof t)try{return t.apply(null,e)}catch(t){console.error("Failed to execute internal method: "+t.toString())}}var C=function(t,e){console.error('Failed to execute callback of "'+t+'": '+e.toString())};function A(e,t,n){if("function"==typeof t)try{return t.apply(null,n)}catch(t){C(e,t)}}function P(n,o,t,r,i){void 0===o&&(o={}),void 0===t&&(t=o),void 0===r&&(r=function(t){return t}),void 0===i&&(i=function(t){return t});var e=_(n),a=!1;return e(k(t),function(t){var e=B(r,[t]);A(n,o.success,[e]),a||(A(n,o.complete,[e]),a=!0)},function(t){var e=B(i,[t]);A(n,o.fail,[e]),a||(A(n,o.complete,[e]),a=!0)})}function N(t,e){return void 0===e&&(e={}),_(t,!0)(k(e))}var t=["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 o=this;this.animations=[],this.currentAnimation=[],this.config={},t.forEach(function(n){o[n]=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return o.currentAnimation.push([n,t]),o}})};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 M=function(t){void 0===t&&(t={}),this._instanceId=w(),this._emitter=new f,this.src=t.src};M.prototype.play=function(t){var e=this;P("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})},M.prototype.pause=function(t){var e=this;P("audioPlayer.pauseVoice",t,{instanceId:this._instanceId},function(t){return e._emitter.emit("pause"),t},function(t){return e._emitter.emit("error",t),t})},M.prototype.stop=function(t){var e=this;P("audioPlayer.stopVoice",t,{instanceId:this._instanceId},function(t){return e._emitter.emit("stop"),t},function(t){return e._emitter.emit("error",t),t})},M.prototype.onPlay=function(t){this._emitter.on("play",t)},M.prototype.onPause=function(t){this._emitter.on("pause",t)},M.prototype.onStop=function(t){this._emitter.on("stop",t)},M.prototype.onError=function(t){this._emitter.on("error",t)},M.prototype.offPlay=function(t){this._emitter.off("play",t)},M.prototype.offPause=function(t){this._emitter.off("pause",t)},M.prototype.offStop=function(t){this._emitter.off("stop",t)},M.prototype.offError=function(t){this._emitter.off("error",t)};var F,L=function(){this._startEmitted=!1,this._emitter=new f};L.prototype.start=function(t){var e=this;void 0===t&&(t={}),this._startEmitted=!1,P("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})},L.prototype.stop=function(t){var e=this;void 0===t&&(t={}),P("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})},L.prototype.onStart=function(t){this._emitter.on("start",t)},L.prototype.onStop=function(t){this._emitter.on("stop",t)},L.prototype.onError=function(t){this._emitter.on("error",t)},L.prototype.offStart=function(t){this._emitter.off("start",t)},L.prototype.offStop=function(t){this._emitter.off("stop",t)},L.prototype.offError=function(t){this._emitter.off("error",t)};var D,O=["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 o=this;this._canvasId=t,this._actions=[],O.forEach(function(n){o[n]=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];o._actions.push({method:n,args:t})}})};function V(t){return l(t)?t.apFilePath||t.filePath:""}R.prototype.draw=function(){b("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(o){var r=this;j.forEach(function(n){r[n]=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];b("lottie",{lottieId:o,action:{method:n,args:t}})}}),U.forEach(function(t){r[t]=function(n){I.on("lottie."+t,function(t){var e=[];t.event&&t.event.args&&(e=t.event.args),t.lottieId===o&&n.apply(r,e)})}})};function W(t){return"/"===t.charAt(0)}function H(t,e){for(var n=e,o=n+1,r=t.length;o<r;n+=1,o+=1)t[n]=t[o];t.pop()}function $(t){return void 0===t&&(t=""),"/"===t[0]?t.slice(1):t}function z(t){return n+JSON.stringify(t.data)}function G(t){return{data:o.test(t.value)?JSON.parse(t.value.substr(n.length)):t.value}}function K(){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 X=["play","pause","stop","requestFullScreen","exitFullScreen","showControls","hideControls","enableLoop","disableLoop"],Y=function(i){var t=this;X.forEach(function(r){t[r]=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var n=m(),o="[[VideoContextAction]]@"+n;h().$emit(o,{action:r,id:i,args:t},n)}})};var Z=new f,Q=["onOpen","onError","onMessage","onClose"],tt=0,et=!1;var nt=Object.freeze({showActionSheet:function(t){P("actionSheet.showActionSheet",t)},chooseAddress:function(t){P("address.chooseAddress",t)},tradePay:function(t){void 0===t&&(t={}),P("alipay.tradePay",t=y("tradePay",t))},createAnimation:function(t){return new x(t)},createInnerAudioContext:function(t){return new M(t)},getRecorderManager:function(t){return F||(F=new L),F},createCanvasContext:function(t){return new R(t)},openChat:function(t){P("chat.open",t)},getClipboard:function(t){P("clipboard.readText",t)},setClipboard:function(t){void 0===t&&(t={}),P("clipboard.writeText",t,{text:t.text})},getNetworkType:function(t){P("connection.getType",t=y("getNetworkType",t),{},function(t){return{networkType:(t.type||"").toUpperCase()}})},onNetworkStatusChange:function(t){D||(D=new f,c("connection").onChange({},function(t){var e=t.type||"";D.emit("networkStatusChange",{networkType:e.toUpperCase()})})),D.on("networkStatusChange",t)},offNetworkStatusChange:function(){D.off("networkStatusChange")},choosePhoneContact:function(t){P("contact.choosePhoneContact",t=y("choosePhoneContact",t),{},function(t){return{name:t.name,mobile:t.phone}})},watchShake:function(t){P("device.onShake",t,{on:!0})},vibrate:function(t){P("device.vibrate",t)},vibrateShort:function(t){P("device.vibrateShort",t)},onUserCaptureScreen:function(t){P("device.onUserCaptureScreen",{success:t})},offUserCaptureScreen:function(){P("device.offUserCaptureScreen")},scan:function(t){P("device.scan",t)},saveFile:function(t){return P("file.saveFile",t,{filePath:V(t)},function(t){return{apFilePath:t.savedFilePath}})},getFileInfo:function(t){return P("file.getFileInfo",t,{filePath:V(t)},function(t){return{size:t.size}})},getSavedFileInfo:function(t){return P("file.getFileInfo",t,{filePath:V(t)})},getSavedFileList:function(t){return P("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 P("file.removeFile",t,{filePath:V(t)})},chooseImage:function(t){P("image.chooseImage",t)},compressImage:function(t){P("image.compressImage",t)},previewImage:function(t){P("image.previewImage",t)},saveImage:function(t){P("image.saveImage",t)},getImageInfo:function(t){P("image.getImageInfo",t)},hideKeyboard:function(){P("keyboard.hideKeyboard")},getLocation:function(t){var n=t.type;P("location.getLocation",t,t,function(t){var e={longitude:t.coords.longitude,latitude:t.coords.latitude,accuracy:t.coords.accuracy};return 0<n&&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){P("miniApp.setWebViewBackgroundImage",t)},removeBackgroundImage:function(t){P("miniApp.setWebViewBackgroundImage",t,{color:"",imgUrl:""})},setViewTop:function(t){P("miniApp.setWebViewTop",t)},setCanPullDown:function(t){P("miniApp.setWebViewParams",t)},setShareAppMessage:function(t){void 0===t&&(t={}),P("miniApp.setAppShareInfo",t,{title:t.title,description:t.desc,imageUrl:t.imageUrl})},pageScrollTo:function(t){void 0===t&&(t={}),b("pageScrollTo",{scrollTop:t.scrollTop})},alert:function(t){void 0===t&&(t={}),P("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",n=t.cancelButtonText||"\u53d6\u6d88";P("modal.confirm",t,{title:t.title,message:t.content,okTitle:e,cancelTitle:n},function(t){return{confirm:t.data===e}})},showToast:function(t){void 0===t&&(t={}),t.duration||(t.duration=2e3),P("modal.toast",t,{message:t.content,duration:t.duration/1e3})},hideToast:function(t){P("modal.hideToast",t)},prompt:function(t){P("modal.prompt",t)},showLoading:function(t){P("modal.showLoading",t)},hideLoading:function(t){P("modal.hideLoading",t)},sendMtop:function(t){P("sendMtop.request",y("sendMtop",t))},navigateTo:function(t,e){void 0===t&&(t={}),void 0===e&&(e=""),P("navigator.push",t=y("navigateTo",t),{url:$(function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"",n=t&&t.split("/")||[],o=e&&e.split("/")||[],r=t&&W(t),i=e&&W(e),a=r||i;if(t&&W(t)?o=n:n.length&&(o.pop(),o=o.concat(n)),!o.length)return"/";var c=void 0;if(o.length){var u=o[o.length-1];c="."===u||".."===u||""===u}else c=!1;for(var s=0,f=o.length;0<=f;f--){var d=o[f];"."===d?H(o,f):".."===d?(H(o,f),s++):s&&(H(o,f),s--)}if(!a)for(;s--;s)o.unshift("..");!a||""===o[0]||o[0]&&W(o[0])||o.unshift("");var l=o.join("/");return c&&"/"!==l.substr(-1)&&(l+="/"),l}(t.url,e)||"")})},navigateBack:function(t){P("navigator.pop",y("navigateBack",t))},redirectTo:function(t){void 0===t&&(t={}),P("navigator.redirectTo",t=y("redirectTo",t),{url:$(t.url)})},switchTab:function(t){void 0===t&&(t={}),P("navigator.switchTab",t=y("switchTab",t),{url:$(t.url)})},navigateToMiniProgram:function(t){P("navigator.navigateToMiniProgram",t)},navigateBackMiniProgram:function(t){P("navigator.navigateBackMiniProgram",t)},setNavigationBar:function(t){P("navigatorBar.setNavigationBar",t)},getStatusBarHeight:function(t){P("navigatorBar.getStatusBarHeight",t,t,function(t){return{height:parseInt(t.data)}})},getNavigationBarHeight:function(t){P("navigatorBar.getHeight",t,t,function(t){return{height:parseInt(t.data)}})},showNavigationBarLoading:function(t){P("navigatorBar.showNavigationBarLoading",t)},hideNavigationBarLoading:function(t){P("navigatorBar.hideNavigationBarLoading",t)},setNavigationBarDrawer:function(t){P("navigatorBar.setDrawer",t)},openNavigationBarDrawer:function(t){P("navigatorBar.openDrawer",t)},closeNavigationBarDrawer:function(t){P("navigatorBar.closeDrawer",t)},setNavigationBarSheet:function(t){P("navigatorBar.setActionSheet",t)},httpRequest:function(n){void 0===n&&(n={});var t=(n=y("httpRequest",n)).method||"GET";if("GET"===t&&l(n.data)){var o=[];Object.keys(n.data).forEach(function(t){var e=n.data[t];o.push(t+"="+JSON.stringify(e))});var e=o.join("&");0<=n.url.indexOf("?")?n.url+=e:n.url+="?"+e}P("network.request",n,{method:t,url:n.url,headers:n.headers||{"Content-Type":"application/x-www-form-urlencoded"},dataType:n.dataType||"json",body:n.data},function(t){return{data:t.data,status:t.status,headers:t.headers}})},uploadFile:function(t){P("network.uploadFile",t)},downloadFile:function(t){P("network.downloadFile",t)},makePhoneCall:function(t){void 0===t&&(t={}),P("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}})),P("picker.chooseCity",t,t,function(t){return{city:t.cityName,adCode:t.cityCode}})},datePicker:function(t){void 0===t&&(t={}),P("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={}),P("screen.setBrightness",t,{brightness:t.brightness})},getScreenBrightness:function(t){P("screen.getScreenBrightness",t,t,function(t){return{brightness:t.value}})},setKeepScreenOn:function(t){void 0===t&&(t={}),P("screen.setAlwaysOn",t,{on:t.keepScreenOn})},shareTinyAppMsg:function(t){P("share.doShare",t)},showSku:function(t){P("sku.show",t)},hideSku:function(t){P("sku.hide",t)},setStorage:function(t){void 0===t&&(t={}),P("storage.setItem",t,{key:t.key,value:z(t)})},setStorageSync:function(t){return N("storage.setItemSync",{key:t.key,value:z(t)})},getStorage:function(t){void 0===t&&(t={}),P("storage.getItem",t,t,G)},getStorageSync:function(t){return G(N("storage.getItemSync",t))},removeStorage:function(t){void 0===t&&(t={}),P("storage.removeItem",t)},removeStorageSync:function(t){return void 0===t&&(t={}),N("storage.removeItemSync",t)},clearStorage:function(t){P("storage.clearStorage",t)},clearStorageSync:function(t){return N("storage.clearStorageSync",t)},getStorageInfo:function(t){P("storage.getStorageInfo",t)},getStorageInfoSync:function(t){return N("storage.getStorageInfoSync",t)},getSystemInfoSync:K,getSystemInfo:function(e){void 0===e&&(e={});try{"function"==typeof e.success&&e.success.call(this,K())}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){P("tabBar.show",t)},hideTabBar:function(t){P("tabBar.hide",t)},setTabBarStyle:function(t){P("tabBar.setTabBarStyle",t)},setTabBarItem:function(t){P("tabBar.setTabBarItem",t)},setTabBarBadge:function(t){P("tabBar.setTabBarBadge",t)},removeTabBarBadge:function(t){P("tabBar.removeTabBarBadge",t)},showTabBarRedDot:function(t){P("tabBar.showTabBarRedDot",t)},hideTabBarRedDot:function(t){P("tabBar.hideTabBarRedDot",t)},uccBind:function(t){P("ucc.uccBind",t)},uccTrustLogin:function(t){P("ucc.uccTrustLogin",t)},uccUnbind:function(t){P("ucc.uccUnbind",t)},reportAnalytics:function(t,e){void 0===e&&(e={}),"click"==t||"enter"==t||"expose"==t?_("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}):_("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 Y(t)},chooseVideo:function(t){P("video.chooseVideo",t,t,function(t){return t.apFilePath&&(t.tempFilePath=t.apFilePath,delete t.apFilePath),t})},saveVideoToPhotosAlbum:function(t){P("video.saveVideoToPhotosAlbum",t)},getAuthUserInfo:function(t){P("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){P("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){P("wopc.getSessionKey",t,t,function(t){return{data:t}})},setTBSessionInfo:function(t){void 0===t&&(t={}),P("wopc.setSessionKey",t,t.sessionInfo,function(t){return{success:!0}})},connectSocket:function(t){void 0===t&&(t={}),et&&(P("webSocket.close",{instanceId:tt}),et=!1,tt++),P("webSocket.webSocket",t,{instanceId:tt,url:t.url,protocol:""},function(t){return et=!0,t}),Q.forEach(function(e){P("webSocket."+e,{instanceId:tt,success:function(t){Z.emit(e,t)}})})},sendSocketMessage:function(t){void 0===t&&(t={}),P("webSocket.send",t,{instanceId:tt,data:t.data})},closeSocket:function(t){P("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)}});function ot(t){var e,n="my";t&&t.defaultName&&(n=t.defaultName);var r,o,i,a=Object.assign({},nt,{canIUse:function(t){return t in nt}});return r=a,(o=h())&&o.$on("registerModuleAPI",function(t){var e=t.data,n=e.scope;if(n)if(p(e.map))if(!r[n]||l(r[n])){var o=r[n]=r[n]||{};e.map.forEach(function(e){o[e.apiName]&&console.warn("my."+n+"."+e.apiName+" is already existed and will be overridded."),o[e.apiName]=function(t){return e.isSync?N(e.moduleMethod,t):P(e.moduleMethod,t)}})}else console.error('"my.'+n+"\" 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.')}),h().$on("[[ModuleAPIEvent]]",function(t){var e=t.type;void 0===e&&(e="");var n=t.data;void 0===n&&(n={});var o=e;n.event&&n.event.name&&(o+="."+n.event.name),I.emit(o,n)}),t&&t.preprocessor&&function(t,e){if(l(t)&&l(e))for(var n in e)o=t,r=n,Object.prototype.hasOwnProperty.call(o,r)&&"function"==typeof e[n]&&(v[n]=e[n]);var o,r}(a,t.preprocessor),t&&t.errorHandler&&"function"==typeof(i=t.errorHandler)&&(C=i),(e={})[n]=a,e}return function(e,n,t){void 0===t&&(t=!0);var o=r();try{Object.defineProperty(o,e,{value:n,configurable:!0,enumerable:!0,writable:!t})}catch(t){o[e]=n}}("__WINDMILL_MODULE_API__",{getAPIs:ot}),ot});
{
"name": "windmill-module-api",
"version": "0.2.55",
"version": "0.2.56",
"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