windmill-module-api
Advanced tools
Comparing version 0.3.3 to 0.3.4
@@ -1,2 +0,2 @@ | ||
/* windmill-module-api (0.3.3), build at 2019-02-18 10:52. */ | ||
/* windmill-module-api (0.3.4), build at 2019-03-07 11:26. */ | ||
@@ -1518,2 +1518,5 @@ (function (global, factory) { | ||
} | ||
function showAuthGuide(options) { | ||
callModule('wopc.showAuthGuide', options); | ||
} | ||
@@ -1746,2 +1749,3 @@ var bus$1 = new EventEmitter(); | ||
authorize: authorize, | ||
showAuthGuide: showAuthGuide, | ||
connectSocket: connectSocket, | ||
@@ -1748,0 +1752,0 @@ sendSocketMessage: sendSocketMessage, |
@@ -1,2 +0,2 @@ | ||
/* windmill-module-api (0.3.3), build at 2019-02-18 10:52. */ | ||
!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 i(){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=i();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 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 l(t){return Object.prototype.toString.call(t).slice(8,-1)}function d(t){return"Object"===l(t)}function p(t){return"Array"===l(t)}function g(){return"object"==typeof __windmill_environment__?__windmill_environment__:"object"==typeof wmlEnv?wmlEnv:"object"==typeof windmillEnv?windmillEnv:{}}function h(){if(!s){var t=i();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 i=o.findIndex(function(t){return t.listener===e});-1!==i&&o.splice(i,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],i=o[t];return Array.isArray(i)&&(o[t]=i.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&&d(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),i=e[0],r=e[1];if(i&&r){var a=c(i);if(a&&"function"==typeof a[r])return a[r]}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 P(e,t,n){if("function"==typeof t)try{return t.apply(null,n)}catch(t){C(e,t)}}var A={};function N(n,o,t,i,r){void 0===o&&(o={}),void 0===t&&(t=o),void 0===i&&(i=function(t){return t}),void 0===r&&(r=function(t){return t});var e=_(n),a=!1;return e(k(t),function(t){var e=B(i,[t]);P(n,o.success,[e]),a||(P(n,o.complete,[e]),a=!0)},function(t){var e=B(r,[t]);P(n,o.fail,[e]),a||(P(n,o.complete,[e]),a=!0)},A)}function E(t,e){return void 0===e&&(e={}),_(t,!0)(k(e),A)}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"],x=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}})};x.prototype.step=function(t){return this.animations.push({config:Object.assign({},this.config,t),animation:this.currentAnimation}),this.currentAnimation=[],this},x.prototype.export=function(){var t=this.animations;return this.animations=[],t};var M=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}(x);var F=function(t){void 0===t&&(t={}),this._instanceId=w(),this._emitter=new f,this.src=t.src};F.prototype.play=function(t){var e=this;N("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})},F.prototype.pause=function(t){var e=this;N("audioPlayer.pauseVoice",t,{instanceId:this._instanceId},function(t){return e._emitter.emit("pause"),t},function(t){return e._emitter.emit("error",t),t})},F.prototype.stop=function(t){var e=this;N("audioPlayer.stopVoice",t,{instanceId:this._instanceId},function(t){return e._emitter.emit("stop"),t},function(t){return e._emitter.emit("error",t),t})},F.prototype.onPlay=function(t){this._emitter.on("play",t)},F.prototype.onPause=function(t){this._emitter.on("pause",t)},F.prototype.onStop=function(t){this._emitter.on("stop",t)},F.prototype.onError=function(t){this._emitter.on("error",t)},F.prototype.offPlay=function(t){this._emitter.off("play",t)},F.prototype.offPause=function(t){this._emitter.off("pause",t)},F.prototype.offStop=function(t){this._emitter.off("stop",t)},F.prototype.offError=function(t){this._emitter.off("error",t)};var D,L=function(){this._startEmitted=!1,this._emitter=new f};L.prototype.start=function(t){var e=this;void 0===t&&(t={}),this._startEmitted=!1,N("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={}),N("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 O,R=["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"],V=function(t){var o=this;this._canvasId=t,this._actions=[],R.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 j(t){return d(t)?t.apFilePath||t.filePath:""}V.prototype.draw=function(){b("canvas",{canvasId:this._canvasId,actions:this._actions}),this._actions=[]};var U=["play","stop","pause","setSpeed","goToAndStop","goToAndPlay","getDuration","setDirection","playSegments","destroy"],W=["onAnimationEnd","onAnimationRepeat","onDataReady","onDataFailed","onAnimationStart","onAnimationCancel"],q=function(o){var i=this;U.forEach(function(n){i[n]=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];b("lottie",{lottieId:o,action:{method:n,args:t}})}}),W.forEach(function(t){i[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(i,e)})}})};function z(t){return"/"===t.charAt(0)}function G(t,e){for(var n=e,o=n+1,i=t.length;o<i;n+=1,o+=1)t[n]=t[o];t.pop()}function H(t){return void 0===t&&(t=""),"/"===t[0]?t.slice(1):t}function $(t){return n+JSON.stringify(t.data)}function K(t){return{data:o.test(t.value)?JSON.parse(t.value.substr(n.length)):t.value}}function J(){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 X=g().version||"";var Y=["play","pause","stop","requestFullScreen","exitFullScreen","showControls","hideControls","enableLoop","disableLoop"],Z=function(r){var t=this;Y.forEach(function(i){t[i]=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var n=m(),o="[[VideoContextAction]]@"+n;h().$emit(o,{action:i,id:r,args:t},n)}})};var Q=new f,tt=["onOpen","onError","onMessage","onClose"],et=0,nt=!1;var ot=function(t){this._webviewId=t};ot.prototype.postMessage=function(t){var e=h();e&&e.$emit("__WEBVIEW_MESSAGE_EVENT_NAME__@"+this._webviewId,t,this._webviewId)};var it=Object.freeze({showActionSheet:function(t){N("actionSheet.showActionSheet",t)},chooseAddress:function(t){N("address.choose",t)},tradePay:function(t){void 0===t&&(t={}),N("alipay.tradePay",t=y("tradePay",t))},createAnimation:function(t){return new M(t)},createInnerAudioContext:function(t){return new F(t)},getRecorderManager:function(t){return D||(D=new L),D},createCanvasContext:function(t){return new V(t)},openChat:function(t){N("chat.open",t)},getClipboard:function(t){N("clipboard.readText",t)},setClipboard:function(t){void 0===t&&(t={}),N("clipboard.writeText",t,{text:t.text})},getNetworkType:function(t){N("connection.getType",t=y("getNetworkType",t),{},function(t){return{networkType:(t.type||"").toUpperCase()}})},onNetworkStatusChange:function(t){O||(O=new f,c("connection").onChange({},function(t){var e=t.type||"";O.emit("networkStatusChange",{networkType:e.toUpperCase()})})),O.on("networkStatusChange",t)},offNetworkStatusChange:function(){O.off("networkStatusChange")},choosePhoneContact:function(t){N("contact.choosePhoneContact",t=y("choosePhoneContact",t),{},function(t){return{name:t.name,mobile:t.phone}})},watchShake:function(t){N("device.onShake",t,{on:!0})},vibrate:function(t){N("device.vibrate",t)},vibrateShort:function(t){N("device.vibrateShort",t)},onUserCaptureScreen:function(t){N("device.onUserCaptureScreen",{success:t})},offUserCaptureScreen:function(){N("device.offUserCaptureScreen")},scan:function(t){N("device.scan",t)},saveFile:function(t){return N("file.saveFile",t,{filePath:j(t)},function(t){return{apFilePath:t.savedFilePath}})},getFileInfo:function(t){return N("file.getFileInfo",t,{filePath:j(t)},function(t){return{size:t.size}})},getSavedFileInfo:function(t){return N("file.getFileInfo",t,{filePath:j(t)})},getSavedFileList:function(t){return N("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 N("file.removeFile",t,{filePath:j(t)})},chooseImage:function(t){N("image.chooseImage",t)},compressImage:function(t){N("image.compressImage",t)},previewImage:function(t){N("image.previewImage",t)},saveImage:function(t){N("image.saveImage",t)},getImageInfo:function(t){N("image.getImageInfo",t)},hideKeyboard:function(){N("keyboard.hideKeyboard")},getLocation:function(t){var n=t.type;N("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){N("miniApp.setWebViewBackgroundImage",t)},removeBackgroundImage:function(t){N("miniApp.setWebViewBackgroundImage",t,{color:"",imgUrl:""})},setViewTop:function(t){N("miniApp.setWebViewTop",t)},setCanPullDown:function(t){N("miniApp.setWebViewParams",t)},setShareAppMessage:function(t){void 0===t&&(t={}),N("miniApp.setAppShareInfo",t,{title:t.title,description:t.desc,imageUrl:t.imageUrl,extraParams:t.extraParams})},startPullDownRefresh:function(t){N("miniApp.startPullDownRefresh",t)},stopPullDownRefresh:function(t){N("miniApp.stopPullDownRefresh",t)},setBackgroundTextStyle:function(t){N("miniApp.setBackgroundTextStyle",t)},setBackgroundColor:function(t){N("miniApp.setBackgroundColor",t)},reLaunch:function(t){N("miniApp.reLaunch",t)},pageScrollTo:function(t){void 0===t&&(t={}),b("pageScrollTo",{scrollTop:t.scrollTop})},alert:function(t){void 0===t&&(t={}),N("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";N("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),N("modal.toast",t,{message:t.content,duration:t.duration/1e3})},hideToast:function(t){N("modal.hideToast",t)},prompt:function(t){N("modal.prompt",t)},showLoading:function(t){N("modal.showLoading",t)},hideLoading:function(t){N("modal.hideLoading",t)},sendMtop:function(t){N("sendMtop.request",y("sendMtop",t))},navigateTo:function(t,e){void 0===t&&(t={}),void 0===e&&(e=""),N("navigator.push",t=y("navigateTo",t),{url:H(function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"",n=t&&t.split("/")||[],o=e&&e.split("/")||[],i=t&&z(t),r=e&&z(e),a=i||r;if(t&&z(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 l=o[f];"."===l?G(o,f):".."===l?(G(o,f),s++):s&&(G(o,f),s--)}if(!a)for(;s--;s)o.unshift("..");!a||""===o[0]||o[0]&&z(o[0])||o.unshift("");var d=o.join("/");return c&&"/"!==d.substr(-1)&&(d+="/"),d}(t.url,e)||"")})},navigateBack:function(t){N("navigator.pop",y("navigateBack",t))},redirectTo:function(t){void 0===t&&(t={}),N("navigator.redirectTo",t=y("redirectTo",t),{url:H(t.url)})},switchTab:function(t){void 0===t&&(t={}),N("navigator.switchTab",t=y("switchTab",t),{url:H(t.url)})},navigateToMiniProgram:function(t){N("navigator.navigateToMiniProgram",t)},navigateBackMiniProgram:function(t){N("navigator.navigateBackMiniProgram",t)},onPageNotify:function(t){N("navigator.pc_onPageNotify",{success:t})},offPageNotify:function(){N("navigator.pc_offPageNotify")},setPageNotifyConfig:function(t){N("navigator.pc_setPageNotifyConfig",t)},getBackStack:function(t){N("navigator.getBackStack",t)},popToHome:function(t){N("navigator.popToHome",t)},setNavigationBar:function(t){N("navigatorBar.setNavigationBar",t)},getStatusBarHeight:function(t){N("navigatorBar.getStatusBarHeight",t,t,function(t){return{height:parseInt(t.data)}})},getNavigationBarHeight:function(t){N("navigatorBar.getHeight",t,t,function(t){return{height:parseInt(t.data)}})},showNavigationBarLoading:function(t){N("navigatorBar.showNavigationBarLoading",t)},hideNavigationBarLoading:function(t){N("navigatorBar.hideNavigationBarLoading",t)},setNavigationBarDrawer:function(t){N("navigatorBar.setDrawer",t)},openNavigationBarDrawer:function(t){N("navigatorBar.openDrawer",t)},closeNavigationBarDrawer:function(t){N("navigatorBar.closeDrawer",t)},setNavigationBarSheet:function(t){N("navigatorBar.setActionSheet",t)},httpRequest:function(o){void 0===o&&(o={});var t=(o=y("httpRequest",o)).method||"GET";if("GET"===t&&d(o.data)){var i=[];Object.keys(o.data).forEach(function(t){var e=o.data[t],n="object"==typeof e?JSON.stringify(e):e;i.push(t+"="+encodeURIComponent(n))});var e=i.join("&");0<=o.url.indexOf("?")?o.url+=e:o.url+="?"+e}N("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){N("network.uploadFile",t)},downloadFile:function(t){N("network.downloadFile",t)},makePhoneCall:function(t){void 0===t&&(t={}),N("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}})),N("picker.chooseCity",t,t,function(t){return{city:t.cityName,adCode:t.cityCode}})},datePicker:function(t){void 0===t&&(t={}),N("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={}),N("screen.setBrightness",t,{brightness:t.brightness})},getScreenBrightness:function(t){N("screen.getScreenBrightness",t,t,function(t){return{brightness:t.value}})},setKeepScreenOn:function(t){void 0===t&&(t={}),N("screen.setAlwaysOn",t,{on:t.keepScreenOn})},shareTinyAppMsg:function(t){N("share.doShare",t)},showSku:function(t){N("sku.show",t)},hideSku:function(t){N("sku.hide",t)},setStorage:function(t){void 0===t&&(t={}),N("storage.setItem",t,{key:t.key,value:$(t)})},setStorageSync:function(t){return E("storage.setItemSync",{key:t.key,value:$(t)})},getStorage:function(t){void 0===t&&(t={}),N("storage.getItem",t,t,K)},getStorageSync:function(t){return K(E("storage.getItemSync",t))},removeStorage:function(t){void 0===t&&(t={}),N("storage.removeItem",t)},removeStorageSync:function(t){return void 0===t&&(t={}),E("storage.removeItemSync",t)},clearStorage:function(t){N("storage.clearStorage",t)},clearStorageSync:function(t){return E("storage.clearStorageSync",t)},getStorageInfo:function(t){N("storage.getStorageInfo",t)},getStorageInfoSync:function(t){return E("storage.getStorageInfoSync",t)},getSystemInfoSync:J,getSystemInfo:function(e){void 0===e&&(e={});try{"function"==typeof e.success&&e.success.call(this,J())}catch(t){"function"==typeof e.fail&&e.fail.call(this,t)}finally{"function"==typeof e.complete&&e.complete.call(this)}},SDKVersion:X,showTabBar:function(t){N("tabBar.show",t)},hideTabBar:function(t){N("tabBar.hide",t)},setTabBarStyle:function(t){N("tabBar.setTabBarStyle",t)},setTabBarItem:function(t){N("tabBar.setTabBarItem",t)},setTabBarBadge:function(t){N("tabBar.setTabBarBadge",t)},removeTabBarBadge:function(t){N("tabBar.removeTabBarBadge",t)},showTabBarRedDot:function(t){N("tabBar.showTabBarRedDot",t)},hideTabBarRedDot:function(t){N("tabBar.hideTabBarRedDot",t)},addTabBarItem:function(t){N("tabBar.addTabBarItem",t)},removeTabBarItem:function(t){N("tabBar.removeTabBarItem",t)},uccBind:function(t){N("ucc.uccBind",t)},uccTrustLogin:function(t){N("ucc.uccTrustLogin",t)},uccUnbind:function(t){N("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})},callUserTrack:function(t,e){void 0===e&&(e={});var n=_("userTrack."+t);"function"==typeof n&&n(e)},createVideoContext:function(t){return new Z(t)},chooseVideo:function(t){N("video.chooseVideo",t,t,function(t){return t.apFilePath&&(t.tempFilePath=t.apFilePath,delete t.apFilePath),t})},saveVideoToPhotosAlbum:function(t){N("video.saveVideoToPhotosAlbum",t)},getAuthUserInfo:function(t){N("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){N("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){N("wopc.getSessionKey",t,t,function(t){return{data:t}})},setTBSessionInfo:function(t){void 0===t&&(t={}),N("wopc.setSessionKey",t,t.sessionInfo,function(t){return{success:!0}})},getSetting:function(t){N("wopc.getSetting",t)},openSetting:function(t){N("wopc.openSetting",t)},authorize:function(t){N("wopc.authorize",t)},connectSocket:function(t){void 0===t&&(t={}),nt&&(N("webSocket.close",{instanceId:et}),nt=!1,et++),N("webSocket.webSocket",t,{instanceId:et,url:t.url,protocol:""},function(t){return nt=!0,t}),tt.forEach(function(e){N("webSocket."+e,{instanceId:et,success:function(t){Q.emit(e,t)}})})},sendSocketMessage:function(t){void 0===t&&(t={}),N("webSocket.send",t,{instanceId:et,data:t.data})},closeSocket:function(t){N("webSocket.close",t,{instanceId:et},function(t){return nt=!1,et++,t})},onSocketOpen:function(t){Q.on("onOpen",t)},offSocketOpen:function(t){Q.off("onOpen",t)},onSocketError:function(t){Q.on("onError",t)},offSocketError:function(t){Q.off("onError",t)},onSocketMessage:function(e){Q.on("onMessage",function(t){e&&e({data:t,isBuffer:!1})})},offSocketMessage:function(t){Q.off("onMessage",t)},onSocketClose:function(t){Q.on("onClose",t)},offSocketClose:function(t){Q.off("onClose",t)},favorShop:function(t){N("eBizCapability.favorShop",t)},collectGoods:function(t){N("eBizCapability.collectGoods",t)},checkShopFavoredStatus:function(t){N("eBizCapability.checkShopFavoredStatus",t)},checkGoodsCollectedStatus:function(t){N("eBizCapability.checkGoodsCollectedStatus",t)},createWebViewContext:function(t){return new ot(t)}});function rt(t){var e,n="my";t&&t.defaultName&&(n=t.defaultName),t&&t.label&&(A.origin=t.label);var i,o,r,a=Object.assign({},it,{canIUse:function(t){return t in it}});return i=a,(o=h())&&o.$on("registerModuleAPI",function(t){var e=t.data,n=e.scope;if(n)if(p(e.map))if(!i[n]||d(i[n])){var o=i[n]=i[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?E(e.moduleMethod,t):N(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(d(t)&&d(e))for(var n in e)o=t,i=n,Object.prototype.hasOwnProperty.call(o,i)&&"function"==typeof e[n]&&(v[n]=e[n]);var o,i}(a,t.preprocessor),t&&t.errorHandler&&"function"==typeof(r=t.errorHandler)&&(C=r),(e={})[n]=a,e}return function(e,n,t){void 0===t&&(t=!0);var o=i();try{Object.defineProperty(o,e,{value:n,configurable:!0,enumerable:!0,writable:!t})}catch(t){o[e]=n}}("__WINDMILL_MODULE_API__",{getAPIs:rt}),rt}); | ||
/* windmill-module-api (0.3.4), build at 2019-03-07 11:26. */ | ||
!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 i(){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=i();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 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=i();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 i=o.findIndex(function(t){return t.listener===e});-1!==i&&o.splice(i,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],i=o[t];return Array.isArray(i)&&(o[t]=i.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),i=e[0],r=e[1];if(i&&r){var a=c(i);if(a&&"function"==typeof a[r])return a[r]}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 P(e,t,n){if("function"==typeof t)try{return t.apply(null,n)}catch(t){C(e,t)}}var A={};function N(n,o,t,i,r){void 0===o&&(o={}),void 0===t&&(t=o),void 0===i&&(i=function(t){return t}),void 0===r&&(r=function(t){return t});var e=_(n),a=!1;return e(k(t),function(t){var e=B(i,[t]);P(n,o.success,[e]),a||(P(n,o.complete,[e]),a=!0)},function(t){var e=B(r,[t]);P(n,o.fail,[e]),a||(P(n,o.complete,[e]),a=!0)},A)}function E(t,e){return void 0===e&&(e={}),_(t,!0)(k(e),A)}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"],x=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}})};x.prototype.step=function(t){return this.animations.push({config:Object.assign({},this.config,t),animation:this.currentAnimation}),this.currentAnimation=[],this},x.prototype.export=function(){var t=this.animations;return this.animations=[],t};var M=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}(x);var F=function(t){void 0===t&&(t={}),this._instanceId=w(),this._emitter=new f,this.src=t.src};F.prototype.play=function(t){var e=this;N("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})},F.prototype.pause=function(t){var e=this;N("audioPlayer.pauseVoice",t,{instanceId:this._instanceId},function(t){return e._emitter.emit("pause"),t},function(t){return e._emitter.emit("error",t),t})},F.prototype.stop=function(t){var e=this;N("audioPlayer.stopVoice",t,{instanceId:this._instanceId},function(t){return e._emitter.emit("stop"),t},function(t){return e._emitter.emit("error",t),t})},F.prototype.onPlay=function(t){this._emitter.on("play",t)},F.prototype.onPause=function(t){this._emitter.on("pause",t)},F.prototype.onStop=function(t){this._emitter.on("stop",t)},F.prototype.onError=function(t){this._emitter.on("error",t)},F.prototype.offPlay=function(t){this._emitter.off("play",t)},F.prototype.offPause=function(t){this._emitter.off("pause",t)},F.prototype.offStop=function(t){this._emitter.off("stop",t)},F.prototype.offError=function(t){this._emitter.off("error",t)};var D,L=function(){this._startEmitted=!1,this._emitter=new f};L.prototype.start=function(t){var e=this;void 0===t&&(t={}),this._startEmitted=!1,N("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={}),N("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 O,R=["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"],V=function(t){var o=this;this._canvasId=t,this._actions=[],R.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 j(t){return l(t)?t.apFilePath||t.filePath:""}V.prototype.draw=function(){b("canvas",{canvasId:this._canvasId,actions:this._actions}),this._actions=[]};var U=["play","stop","pause","setSpeed","goToAndStop","goToAndPlay","getDuration","setDirection","playSegments","destroy"],W=["onAnimationEnd","onAnimationRepeat","onDataReady","onDataFailed","onAnimationStart","onAnimationCancel"],q=function(o){var i=this;U.forEach(function(n){i[n]=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];b("lottie",{lottieId:o,action:{method:n,args:t}})}}),W.forEach(function(t){i[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(i,e)})}})};function G(t){return"/"===t.charAt(0)}function z(t,e){for(var n=e,o=n+1,i=t.length;o<i;n+=1,o+=1)t[n]=t[o];t.pop()}function H(t){return void 0===t&&(t=""),"/"===t[0]?t.slice(1):t}function $(t){return n+JSON.stringify(t.data)}function K(t){return{data:o.test(t.value)?JSON.parse(t.value.substr(n.length)):t.value}}function J(){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 X=g().version||"";var Y=["play","pause","stop","requestFullScreen","exitFullScreen","showControls","hideControls","enableLoop","disableLoop"],Z=function(r){var t=this;Y.forEach(function(i){t[i]=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var n=m(),o="[[VideoContextAction]]@"+n;h().$emit(o,{action:i,id:r,args:t},n)}})};var Q=new f,tt=["onOpen","onError","onMessage","onClose"],et=0,nt=!1;var ot=function(t){this._webviewId=t};ot.prototype.postMessage=function(t){var e=h();e&&e.$emit("__WEBVIEW_MESSAGE_EVENT_NAME__@"+this._webviewId,t,this._webviewId)};var it=Object.freeze({showActionSheet:function(t){N("actionSheet.showActionSheet",t)},chooseAddress:function(t){N("address.choose",t)},tradePay:function(t){void 0===t&&(t={}),N("alipay.tradePay",t=y("tradePay",t))},createAnimation:function(t){return new M(t)},createInnerAudioContext:function(t){return new F(t)},getRecorderManager:function(t){return D||(D=new L),D},createCanvasContext:function(t){return new V(t)},openChat:function(t){N("chat.open",t)},getClipboard:function(t){N("clipboard.readText",t)},setClipboard:function(t){void 0===t&&(t={}),N("clipboard.writeText",t,{text:t.text})},getNetworkType:function(t){N("connection.getType",t=y("getNetworkType",t),{},function(t){return{networkType:(t.type||"").toUpperCase()}})},onNetworkStatusChange:function(t){O||(O=new f,c("connection").onChange({},function(t){var e=t.type||"";O.emit("networkStatusChange",{networkType:e.toUpperCase()})})),O.on("networkStatusChange",t)},offNetworkStatusChange:function(){O.off("networkStatusChange")},choosePhoneContact:function(t){N("contact.choosePhoneContact",t=y("choosePhoneContact",t),{},function(t){return{name:t.name,mobile:t.phone}})},watchShake:function(t){N("device.onShake",t,{on:!0})},vibrate:function(t){N("device.vibrate",t)},vibrateShort:function(t){N("device.vibrateShort",t)},onUserCaptureScreen:function(t){N("device.onUserCaptureScreen",{success:t})},offUserCaptureScreen:function(){N("device.offUserCaptureScreen")},scan:function(t){N("device.scan",t)},saveFile:function(t){return N("file.saveFile",t,{filePath:j(t)},function(t){return{apFilePath:t.savedFilePath}})},getFileInfo:function(t){return N("file.getFileInfo",t,{filePath:j(t)},function(t){return{size:t.size}})},getSavedFileInfo:function(t){return N("file.getFileInfo",t,{filePath:j(t)})},getSavedFileList:function(t){return N("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 N("file.removeFile",t,{filePath:j(t)})},chooseImage:function(t){N("image.chooseImage",t)},compressImage:function(t){N("image.compressImage",t)},previewImage:function(t){N("image.previewImage",t)},saveImage:function(t){N("image.saveImage",t)},getImageInfo:function(t){N("image.getImageInfo",t)},hideKeyboard:function(){N("keyboard.hideKeyboard")},getLocation:function(t){var n=t.type;N("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){N("miniApp.setWebViewBackgroundImage",t)},removeBackgroundImage:function(t){N("miniApp.setWebViewBackgroundImage",t,{color:"",imgUrl:""})},setViewTop:function(t){N("miniApp.setWebViewTop",t)},setCanPullDown:function(t){N("miniApp.setWebViewParams",t)},setShareAppMessage:function(t){void 0===t&&(t={}),N("miniApp.setAppShareInfo",t,{title:t.title,description:t.desc,imageUrl:t.imageUrl,extraParams:t.extraParams})},startPullDownRefresh:function(t){N("miniApp.startPullDownRefresh",t)},stopPullDownRefresh:function(t){N("miniApp.stopPullDownRefresh",t)},setBackgroundTextStyle:function(t){N("miniApp.setBackgroundTextStyle",t)},setBackgroundColor:function(t){N("miniApp.setBackgroundColor",t)},reLaunch:function(t){N("miniApp.reLaunch",t)},pageScrollTo:function(t){void 0===t&&(t={}),b("pageScrollTo",{scrollTop:t.scrollTop})},alert:function(t){void 0===t&&(t={}),N("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";N("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),N("modal.toast",t,{message:t.content,duration:t.duration/1e3})},hideToast:function(t){N("modal.hideToast",t)},prompt:function(t){N("modal.prompt",t)},showLoading:function(t){N("modal.showLoading",t)},hideLoading:function(t){N("modal.hideLoading",t)},sendMtop:function(t){N("sendMtop.request",y("sendMtop",t))},navigateTo:function(t,e){void 0===t&&(t={}),void 0===e&&(e=""),N("navigator.push",t=y("navigateTo",t),{url:H(function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"",n=t&&t.split("/")||[],o=e&&e.split("/")||[],i=t&&G(t),r=e&&G(e),a=i||r;if(t&&G(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?z(o,f):".."===d?(z(o,f),s++):s&&(z(o,f),s--)}if(!a)for(;s--;s)o.unshift("..");!a||""===o[0]||o[0]&&G(o[0])||o.unshift("");var l=o.join("/");return c&&"/"!==l.substr(-1)&&(l+="/"),l}(t.url,e)||"")})},navigateBack:function(t){N("navigator.pop",y("navigateBack",t))},redirectTo:function(t){void 0===t&&(t={}),N("navigator.redirectTo",t=y("redirectTo",t),{url:H(t.url)})},switchTab:function(t){void 0===t&&(t={}),N("navigator.switchTab",t=y("switchTab",t),{url:H(t.url)})},navigateToMiniProgram:function(t){N("navigator.navigateToMiniProgram",t)},navigateBackMiniProgram:function(t){N("navigator.navigateBackMiniProgram",t)},onPageNotify:function(t){N("navigator.pc_onPageNotify",{success:t})},offPageNotify:function(){N("navigator.pc_offPageNotify")},setPageNotifyConfig:function(t){N("navigator.pc_setPageNotifyConfig",t)},getBackStack:function(t){N("navigator.getBackStack",t)},popToHome:function(t){N("navigator.popToHome",t)},setNavigationBar:function(t){N("navigatorBar.setNavigationBar",t)},getStatusBarHeight:function(t){N("navigatorBar.getStatusBarHeight",t,t,function(t){return{height:parseInt(t.data)}})},getNavigationBarHeight:function(t){N("navigatorBar.getHeight",t,t,function(t){return{height:parseInt(t.data)}})},showNavigationBarLoading:function(t){N("navigatorBar.showNavigationBarLoading",t)},hideNavigationBarLoading:function(t){N("navigatorBar.hideNavigationBarLoading",t)},setNavigationBarDrawer:function(t){N("navigatorBar.setDrawer",t)},openNavigationBarDrawer:function(t){N("navigatorBar.openDrawer",t)},closeNavigationBarDrawer:function(t){N("navigatorBar.closeDrawer",t)},setNavigationBarSheet:function(t){N("navigatorBar.setActionSheet",t)},httpRequest:function(o){void 0===o&&(o={});var t=(o=y("httpRequest",o)).method||"GET";if("GET"===t&&l(o.data)){var i=[];Object.keys(o.data).forEach(function(t){var e=o.data[t],n="object"==typeof e?JSON.stringify(e):e;i.push(t+"="+encodeURIComponent(n))});var e=i.join("&");0<=o.url.indexOf("?")?o.url+=e:o.url+="?"+e}N("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){N("network.uploadFile",t)},downloadFile:function(t){N("network.downloadFile",t)},makePhoneCall:function(t){void 0===t&&(t={}),N("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}})),N("picker.chooseCity",t,t,function(t){return{city:t.cityName,adCode:t.cityCode}})},datePicker:function(t){void 0===t&&(t={}),N("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={}),N("screen.setBrightness",t,{brightness:t.brightness})},getScreenBrightness:function(t){N("screen.getScreenBrightness",t,t,function(t){return{brightness:t.value}})},setKeepScreenOn:function(t){void 0===t&&(t={}),N("screen.setAlwaysOn",t,{on:t.keepScreenOn})},shareTinyAppMsg:function(t){N("share.doShare",t)},showSku:function(t){N("sku.show",t)},hideSku:function(t){N("sku.hide",t)},setStorage:function(t){void 0===t&&(t={}),N("storage.setItem",t,{key:t.key,value:$(t)})},setStorageSync:function(t){return E("storage.setItemSync",{key:t.key,value:$(t)})},getStorage:function(t){void 0===t&&(t={}),N("storage.getItem",t,t,K)},getStorageSync:function(t){return K(E("storage.getItemSync",t))},removeStorage:function(t){void 0===t&&(t={}),N("storage.removeItem",t)},removeStorageSync:function(t){return void 0===t&&(t={}),E("storage.removeItemSync",t)},clearStorage:function(t){N("storage.clearStorage",t)},clearStorageSync:function(t){return E("storage.clearStorageSync",t)},getStorageInfo:function(t){N("storage.getStorageInfo",t)},getStorageInfoSync:function(t){return E("storage.getStorageInfoSync",t)},getSystemInfoSync:J,getSystemInfo:function(e){void 0===e&&(e={});try{"function"==typeof e.success&&e.success.call(this,J())}catch(t){"function"==typeof e.fail&&e.fail.call(this,t)}finally{"function"==typeof e.complete&&e.complete.call(this)}},SDKVersion:X,showTabBar:function(t){N("tabBar.show",t)},hideTabBar:function(t){N("tabBar.hide",t)},setTabBarStyle:function(t){N("tabBar.setTabBarStyle",t)},setTabBarItem:function(t){N("tabBar.setTabBarItem",t)},setTabBarBadge:function(t){N("tabBar.setTabBarBadge",t)},removeTabBarBadge:function(t){N("tabBar.removeTabBarBadge",t)},showTabBarRedDot:function(t){N("tabBar.showTabBarRedDot",t)},hideTabBarRedDot:function(t){N("tabBar.hideTabBarRedDot",t)},addTabBarItem:function(t){N("tabBar.addTabBarItem",t)},removeTabBarItem:function(t){N("tabBar.removeTabBarItem",t)},uccBind:function(t){N("ucc.uccBind",t)},uccTrustLogin:function(t){N("ucc.uccTrustLogin",t)},uccUnbind:function(t){N("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})},callUserTrack:function(t,e){void 0===e&&(e={});var n=_("userTrack."+t);"function"==typeof n&&n(e)},createVideoContext:function(t){return new Z(t)},chooseVideo:function(t){N("video.chooseVideo",t,t,function(t){return t.apFilePath&&(t.tempFilePath=t.apFilePath,delete t.apFilePath),t})},saveVideoToPhotosAlbum:function(t){N("video.saveVideoToPhotosAlbum",t)},getAuthUserInfo:function(t){N("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){N("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){N("wopc.getSessionKey",t,t,function(t){return{data:t}})},setTBSessionInfo:function(t){void 0===t&&(t={}),N("wopc.setSessionKey",t,t.sessionInfo,function(t){return{success:!0}})},getSetting:function(t){N("wopc.getSetting",t)},openSetting:function(t){N("wopc.openSetting",t)},authorize:function(t){N("wopc.authorize",t)},showAuthGuide:function(t){N("wopc.showAuthGuide",t)},connectSocket:function(t){void 0===t&&(t={}),nt&&(N("webSocket.close",{instanceId:et}),nt=!1,et++),N("webSocket.webSocket",t,{instanceId:et,url:t.url,protocol:""},function(t){return nt=!0,t}),tt.forEach(function(e){N("webSocket."+e,{instanceId:et,success:function(t){Q.emit(e,t)}})})},sendSocketMessage:function(t){void 0===t&&(t={}),N("webSocket.send",t,{instanceId:et,data:t.data})},closeSocket:function(t){N("webSocket.close",t,{instanceId:et},function(t){return nt=!1,et++,t})},onSocketOpen:function(t){Q.on("onOpen",t)},offSocketOpen:function(t){Q.off("onOpen",t)},onSocketError:function(t){Q.on("onError",t)},offSocketError:function(t){Q.off("onError",t)},onSocketMessage:function(e){Q.on("onMessage",function(t){e&&e({data:t,isBuffer:!1})})},offSocketMessage:function(t){Q.off("onMessage",t)},onSocketClose:function(t){Q.on("onClose",t)},offSocketClose:function(t){Q.off("onClose",t)},favorShop:function(t){N("eBizCapability.favorShop",t)},collectGoods:function(t){N("eBizCapability.collectGoods",t)},checkShopFavoredStatus:function(t){N("eBizCapability.checkShopFavoredStatus",t)},checkGoodsCollectedStatus:function(t){N("eBizCapability.checkGoodsCollectedStatus",t)},createWebViewContext:function(t){return new ot(t)}});function rt(t){var e,n="my";t&&t.defaultName&&(n=t.defaultName),t&&t.label&&(A.origin=t.label);var i,o,r,a=Object.assign({},it,{canIUse:function(t){return t in it}});return i=a,(o=h())&&o.$on("registerModuleAPI",function(t){var e=t.data,n=e.scope;if(n)if(p(e.map))if(!i[n]||l(i[n])){var o=i[n]=i[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?E(e.moduleMethod,t):N(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,i=n,Object.prototype.hasOwnProperty.call(o,i)&&"function"==typeof e[n]&&(v[n]=e[n]);var o,i}(a,t.preprocessor),t&&t.errorHandler&&"function"==typeof(r=t.errorHandler)&&(C=r),(e={})[n]=a,e}return function(e,n,t){void 0===t&&(t=!0);var o=i();try{Object.defineProperty(o,e,{value:n,configurable:!0,enumerable:!0,writable:!t})}catch(t){o[e]=n}}("__WINDMILL_MODULE_API__",{getAPIs:rt}),rt}); |
{ | ||
"name": "windmill-module-api", | ||
"version": "0.3.3", | ||
"version": "0.3.4", | ||
"description": "Standard module APIs of windmill.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
145650
3357