app-methods
Advanced tools
Comparing version 0.0.3 to 0.0.4
@@ -1,2 +0,2 @@ | ||
/*! app.js v0.0.3 | https://www.npmjs.com/package/app-methods */ | ||
/*! app.js v0.0.4 | https://www.npmjs.com/package/app-methods */ | ||
'use strict'; | ||
@@ -378,3 +378,2 @@ | ||
var userAgents = { | ||
ping: 'ele_information', | ||
xy: 'eve' | ||
@@ -403,6 +402,18 @@ }; | ||
var hideBar = sdk.hideBar; | ||
var showBar = sdk.showBar; | ||
var exit = sdk.exit; | ||
// 由于 Ping 的 user-agent 没有唯一标志符,所以始终尝试调用一下 Ping 的 API | ||
function hideBar () { | ||
sdk.hideBar(); | ||
hideBar$1(); | ||
} | ||
function showBar () { | ||
sdk.showBar(); | ||
showBar$1(); | ||
} | ||
function exit () { | ||
sdk.exit(); | ||
exit$1(); | ||
} | ||
exports.platform = platform$1; | ||
@@ -409,0 +420,0 @@ exports.hideBar = hideBar; |
@@ -1,2 +0,2 @@ | ||
/*! app.js v0.0.3 | https://www.npmjs.com/package/app-methods */ | ||
/*! app.js v0.0.4 | https://www.npmjs.com/package/app-methods */ | ||
/* global App:false */ | ||
@@ -374,3 +374,2 @@ /** | ||
var userAgents = { | ||
ping: 'ele_information', | ||
xy: 'eve' | ||
@@ -399,6 +398,18 @@ }; | ||
var hideBar = sdk.hideBar; | ||
var showBar = sdk.showBar; | ||
var exit = sdk.exit; | ||
// 由于 Ping 的 user-agent 没有唯一标志符,所以始终尝试调用一下 Ping 的 API | ||
function hideBar () { | ||
sdk.hideBar(); | ||
hideBar$1(); | ||
} | ||
function showBar () { | ||
sdk.showBar(); | ||
showBar$1(); | ||
} | ||
function exit () { | ||
sdk.exit(); | ||
exit$1(); | ||
} | ||
export { platform$1 as platform, hideBar, showBar, exit }; |
@@ -1,2 +0,2 @@ | ||
/*! app.js v0.0.3 | https://www.npmjs.com/package/app-methods */ | ||
/*! app.js v0.0.4 | https://www.npmjs.com/package/app-methods */ | ||
(function (global, factory) { | ||
@@ -380,3 +380,2 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : | ||
var userAgents = { | ||
ping: 'ele_information', | ||
xy: 'eve' | ||
@@ -405,6 +404,18 @@ }; | ||
var hideBar = sdk.hideBar; | ||
var showBar = sdk.showBar; | ||
var exit = sdk.exit; | ||
// 由于 Ping 的 user-agent 没有唯一标志符,所以始终尝试调用一下 Ping 的 API | ||
function hideBar () { | ||
sdk.hideBar(); | ||
hideBar$1(); | ||
} | ||
function showBar () { | ||
sdk.showBar(); | ||
showBar$1(); | ||
} | ||
function exit () { | ||
sdk.exit(); | ||
exit$1(); | ||
} | ||
exports.platform = platform$1; | ||
@@ -411,0 +422,0 @@ exports.hideBar = hideBar; |
@@ -1,2 +0,2 @@ | ||
/*! app.js v0.0.3 | https://www.npmjs.com/package/app-methods */ | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(e.app=e.app||{})}(this,function(e){"use strict";function n(){try{App.hideBar()}catch(e){}}function t(){try{App.showBar()}catch(e){}}function i(){try{App.close()}catch(e){}}function o(){u.then(function(){yasuo.page.finish()})}function r(){u.then(function(){yasuo.page.hideBar()})}function a(){u.then(function(){yasuo.page.showBar()})}function c(){u=new Promise(function(e){document.addEventListener("yasuoReady",e)}),d()}function d(){function e(e,n,i){window.WebViewJavascriptBridge.callHandler(e,n,function(e){if(i){var n=t?JSON.parse(e):e;n.err?i(n.err,null):n.res&&i(null,n.res)}})}function n(n,t){var i={};i.data=JSON.stringify(n)||"",e("Toast",JSON.stringify(i),t)}var t=h.indexOf("android")>-1,i=h.indexOf("iphone")>-1,o={showBar:function(){e("TitleBar","show",null)},hideBar:function(){e("TitleBar","hide",null)},finish:function(){e("Page","finish",null)},showLoading:function(n,t){n=n||{},n.mode="show",e("Loading",n,t)},hideLoading:function(n,t){n=n||{},n.mode="hide",e("Loading",n,t)}},r={getTime:function(n,t){n=n||{},n.mode="time",e("TimePicker",n,t)},getDate:function(n,t){n=n||{},n.mode="date",e("TimePicker",n,t)},getTimeDate:function(n,t){n=n||{},n.mode="time_date",e("TimePicker",n,t)}},a={hide:function(n,t){n=n||{},n.mode="hide",e("Keyboard",n,t)},show:function(n,t){n=n||{},n.mode="show",e("Keyboard",n,t)}},c={getPicture:function(n,t){n=n||{},n.mode="image",e("Camera",n,t)},getAlbum:function(n,t){n=n||{},n.mode="album",e("Camera",n,t)}},d={transfer:function(n,t){e("File",n,t)}},u={checkVersion:function(n){var t={};t.mode="checkVersion",e("App",t,n)},info:function(n){var t={};t.mode="info",e("App",t,n)},hotUpdate:function(n){var t={};t.mode="hotupdate",e("App",t,n)}},f=function(n){e("Device",{},n)},s={logout:function(n){var t={};t.mode="logout",e("User",t,n)},clearToken:function(n){var t={};t.mode="clear",e("User",t,n)}},v=window.yasuo={init:function(e){window.WebViewJavascriptBridge.init(e)},isAndroid:function(){return t},isIOS:function(){return i},showToast:n,camera:c,keyboard:a,timePicker:r,page:o,file:d,network:function(n){e("NetworkInfo",{},n)},app:u,device:f,user:s,version:"0.0.1"};document.addEventListener("WebViewJavascriptBridgeReady",function(){var e=window.WebViewJavascriptBridge;if(e){var n=document.createEvent("Events");n.initEvent("yasuoReady"),document.dispatchEvent(n),v.init();var t=document.createEvent("Events");t.initEvent("Keyboard.hide");var i=document.createEvent("Events");i.initEvent("Keyboard.show"),e.registerHandler("Keyboard.hide",function(e,n){document.dispatchEvent(t)}),e.registerHandler("Keyboard.show",function(e,n){document.dispatchEvent(i)});var o=document.createEvent("Events");o.initEvent("onLandscapeScreen"),e.registerHandler("onLandscapeScreen",function(e,n){document.dispatchEvent(o)});var r=document.createEvent("Events");r.initEvent("onPortraitScreen"),e.registerHandler("onPortraitScreen",function(e,n){document.dispatchEvent(r)});var a=document.createEvent("Events");a.initEvent("networkStateChange"),e.registerHandler("networkStateChange",function(e,n){a.data=e,document.dispatchEvent(a)})}})}var u,f,s=Object.freeze({hideBar:n,showBar:t,exit:i}),h=navigator.userAgent.toLowerCase(),v=Object.freeze({exit:o,hideBar:r,showBar:a,init:c}),p=function(){},m=Object.freeze({hideBar:p,showBar:p,exit:p}),l=Object.freeze({ping:s,xy:v,other:m}),w={ping:"ele_information",xy:"eve"},g=Object.prototype.hasOwnProperty;for(var y in w)if(g.call(w,y)&&h.indexOf(w[y])>=0){f=y;break}var E=f||"other",B=l[E];B.init&&B.init();var b=B.hideBar,O=B.showBar,k=B.exit;e.platform=E,e.hideBar=b,e.showBar=O,e.exit=k,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
/*! app.js v0.0.4 | https://www.npmjs.com/package/app-methods */ | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(e.app=e.app||{})}(this,function(e){"use strict";function n(){try{App.hideBar()}catch(e){}}function t(){try{App.showBar()}catch(e){}}function i(){try{App.close()}catch(e){}}function o(){h.then(function(){yasuo.page.finish()})}function r(){h.then(function(){yasuo.page.hideBar()})}function a(){h.then(function(){yasuo.page.showBar()})}function c(){h=new Promise(function(e){document.addEventListener("yasuoReady",e)}),d()}function d(){function e(e,n,i){window.WebViewJavascriptBridge.callHandler(e,n,function(e){if(i){var n=t?JSON.parse(e):e;n.err?i(n.err,null):n.res&&i(null,n.res)}})}function n(n,t){var i={};i.data=JSON.stringify(n)||"",e("Toast",JSON.stringify(i),t)}var t=m.indexOf("android")>-1,i=m.indexOf("iphone")>-1,o={showBar:function(){e("TitleBar","show",null)},hideBar:function(){e("TitleBar","hide",null)},finish:function(){e("Page","finish",null)},showLoading:function(n,t){n=n||{},n.mode="show",e("Loading",n,t)},hideLoading:function(n,t){n=n||{},n.mode="hide",e("Loading",n,t)}},r={getTime:function(n,t){n=n||{},n.mode="time",e("TimePicker",n,t)},getDate:function(n,t){n=n||{},n.mode="date",e("TimePicker",n,t)},getTimeDate:function(n,t){n=n||{},n.mode="time_date",e("TimePicker",n,t)}},a={hide:function(n,t){n=n||{},n.mode="hide",e("Keyboard",n,t)},show:function(n,t){n=n||{},n.mode="show",e("Keyboard",n,t)}},c={getPicture:function(n,t){n=n||{},n.mode="image",e("Camera",n,t)},getAlbum:function(n,t){n=n||{},n.mode="album",e("Camera",n,t)}},d={transfer:function(n,t){e("File",n,t)}},u={checkVersion:function(n){var t={};t.mode="checkVersion",e("App",t,n)},info:function(n){var t={};t.mode="info",e("App",t,n)},hotUpdate:function(n){var t={};t.mode="hotupdate",e("App",t,n)}},f=function(n){e("Device",{},n)},s={logout:function(n){var t={};t.mode="logout",e("User",t,n)},clearToken:function(n){var t={};t.mode="clear",e("User",t,n)}},h=window.yasuo={init:function(e){window.WebViewJavascriptBridge.init(e)},isAndroid:function(){return t},isIOS:function(){return i},showToast:n,camera:c,keyboard:a,timePicker:r,page:o,file:d,network:function(n){e("NetworkInfo",{},n)},app:u,device:f,user:s,version:"0.0.1"};document.addEventListener("WebViewJavascriptBridgeReady",function(){var e=window.WebViewJavascriptBridge;if(e){var n=document.createEvent("Events");n.initEvent("yasuoReady"),document.dispatchEvent(n),h.init();var t=document.createEvent("Events");t.initEvent("Keyboard.hide");var i=document.createEvent("Events");i.initEvent("Keyboard.show"),e.registerHandler("Keyboard.hide",function(e,n){document.dispatchEvent(t)}),e.registerHandler("Keyboard.show",function(e,n){document.dispatchEvent(i)});var o=document.createEvent("Events");o.initEvent("onLandscapeScreen"),e.registerHandler("onLandscapeScreen",function(e,n){document.dispatchEvent(o)});var r=document.createEvent("Events");r.initEvent("onPortraitScreen"),e.registerHandler("onPortraitScreen",function(e,n){document.dispatchEvent(r)});var a=document.createEvent("Events");a.initEvent("networkStateChange"),e.registerHandler("networkStateChange",function(e,n){a.data=e,document.dispatchEvent(a)})}})}function u(){k.hideBar(),n()}function f(){k.showBar(),t()}function s(){k.exit(),i()}var h,v,p=Object.freeze({hideBar:n,showBar:t,exit:i}),m=navigator.userAgent.toLowerCase(),l=Object.freeze({exit:o,hideBar:r,showBar:a,init:c}),w=function(){},g=Object.freeze({hideBar:w,showBar:w,exit:w}),y=Object.freeze({ping:p,xy:l,other:g}),E={xy:"eve"},B=Object.prototype.hasOwnProperty;for(var b in E)if(B.call(E,b)&&m.indexOf(E[b])>=0){v=b;break}var O=v||"other",k=y[O];k.init&&k.init(),e.platform=O,e.hideBar=u,e.showBar=f,e.exit=s,Object.defineProperty(e,"__esModule",{value:!0})}); |
{ | ||
"name": "app-methods", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"main": "dist/app.common.js", | ||
@@ -5,0 +5,0 @@ "module": "dist/app.esm.js", |
34334
1117