Liu Song’s Projects


~/Projects/flyover

git clone https://code.lsong.org/flyover

Commit

Commit
79e52ab36f42264a812b13cc0480af3ae4497229
Author
刘松(宙斯) <[email protected]>
Date
2020-07-22 19:34:07 +0800 +0800
Diffstat
 dist/alipay/index.d.ts | 18 +++++++++++++++++-
 dist/alipay/index.js | 22 ++++++++++++++++++++++
 dist/flyover.js | 24 ++++++++++++++++++++++++
 dist/koubei/index.d.ts | 18 +++++++++++++++++-
 dist/koubei/index.js | 22 ++++++++++++++++++++++
 dist/mybank/index.d.ts | 18 +++++++++++++++++-
 dist/mybank/index.js | 22 ++++++++++++++++++++++
 package.json | 2 +-
 src/index.ts | 14 ++++++++++++++
 src/nebula/index.ts | 2 ++
 types/index.d.ts | 37 ++++++++++++++++++++++++++++++++++++-

add missing optionMenu


diff --git a/dist/alipay/index.d.ts b/dist/alipay/index.d.ts
index aa224b2241b2812ac46ed0eec409a5f9ae8e4edf..dfe307f0b561df5e8155098a5b28156ba35a9657 100644
--- a/dist/alipay/index.d.ts
+++ b/dist/alipay/index.d.ts
@@ -105,10 +105,26 @@
 declare const closeWebview: () => Promise<any>;
 
     type: 'none' | 'success' | 'fail' | 'exception';
+    duration: number;
+    icontype?: "scan" | "user";
+    redDot?: string;
+};
+declare type OptionMenuType = {
+    menus: Array<OptionMenuItem>;
+    override?: boolean;
+};
+/**
+ * https://myjsapi.alipay.com/jsapi/events/option-menu.html
+ */
+    duration: number;
 
+declare const hideOptionMenu: () => void;
 
     type: 'none' | 'success' | 'fail' | 'exception';
-declare type ToastOption = {
+
 
     type: 'none' | 'success' | 'fail' | 'exception';
+declare type ToastOption = {
+
+    duration: number;
     type: 'none' | 'success' | 'fail' | 'exception';




diff --git a/dist/alipay/index.js b/dist/alipay/index.js
index e6e528c17ea05a90bb5694ba609b7746d10556fa..e97e8adb4263cf266c11247174bd78607418ae63 100644
--- a/dist/alipay/index.js
+++ b/dist/alipay/index.js
@@ -175,6 +175,25 @@     return pcall('closeWebview');
 };
 
 'use strict';
+    return new Promise(function (resolve, reject) {
+    document.addEventListener(type, fn, false);
+    return function () { return document.removeEventListener(type, fn); };
+};
+
+/**
+ * https://myjsapi.alipay.com/jsapi/events/option-menu.html
+ */
+var optionMenu = function (options, fn) {
+    call('setOptionMenu', options);
+    call('showOptionMenu');
+    addEventListener('optionMenu', fn);
+    return hideOptionMenu;
+};
+var hideOptionMenu = function () {
+    return call('hideOptionMenu');
+};
+
+'use strict';
     };

     return pcall('openInBrowser', { url: url });
 };
@@ -192,7 +211,10 @@ exports.handleResponse = handleResponse;
 exports.hideBackButton = hideBackButton;
 exports.hideLoading = hideLoading;
 'use strict';
+var toast = function (content, options) {
+'use strict';
     if (window.AlipayJSBridge) {
+exports.optionMenu = optionMenu;
 exports.pcall = pcall;
 exports.popWindow = popWindow;
 exports.pushWindow = pushWindow;




diff --git a/dist/flyover.js b/dist/flyover.js
index a868a0d6321677cf112897903758a2add50f27a8..9b7f8e2aeddbee7258c6ed17ce612f827d5276d0 100644
--- a/dist/flyover.js
+++ b/dist/flyover.js
@@ -292,6 +292,19 @@     var closeWebview = function () {
         return pcall$1('closeWebview');
     };
 
+    /**
+     * https://myjsapi.alipay.com/jsapi/events/option-menu.html
+     */
+    var optionMenu = function (options, fn) {
+        call$1('setOptionMenu', options);
+        call$1('showOptionMenu');
+        addEventListener$1('optionMenu', fn);
+        return hideOptionMenu;
+    };
+    var hideOptionMenu = function () {
+        return call$1('hideOptionMenu');
+    };
+
     var openInBrowser = function (url) {
         return pcall$1('openInBrowser', { url: url });
     };
@@ -320,6 +333,8 @@         hideLoading: hideLoading$1,
         popWindow: popWindow,
         pushWindow: pushWindow,
         closeWebview: closeWebview,
+        optionMenu: optionMenu,
+        hideOptionMenu: hideOptionMenu,
         openInBrowser: openInBrowser,
         restorePullToRefresh: restorePullToRefresh
     });
@@ -344,6 +359,8 @@         hideLoading: hideLoading$1,
         popWindow: popWindow,
         pushWindow: pushWindow,
         closeWebview: closeWebview,
+        optionMenu: optionMenu,
+        hideOptionMenu: hideOptionMenu,
         openInBrowser: openInBrowser,
         restorePullToRefresh: restorePullToRefresh
     });
@@ -368,6 +385,8 @@         hideLoading: hideLoading$1,
         popWindow: popWindow,
         pushWindow: pushWindow,
         closeWebview: closeWebview,
+        optionMenu: optionMenu,
+        hideOptionMenu: hideOptionMenu,
         openInBrowser: openInBrowser,
         restorePullToRefresh: restorePullToRefresh
     });
@@ -481,6 +500,10 @@     var getTitleAndStatusbarHeight$1 = function () {
         return call$2('getTitleAndStatusbarHeight');
     };
     typeof define === 'function' && define.amd ? define(['exports'], factory) :
+        var _a = options.buttonText, buttonText = _a === void 0 ? '确定' : _a;
+        return call$2('optionMenu', options, fn);
+    };
+    typeof define === 'function' && define.amd ? define(['exports'], factory) :
     typeof define === 'function' && define.amd ? define(['exports'], factory) :
         return call$2('ready', fn);
     };
@@ -529,6 +552,7 @@     exports.onPause = onPause;
     exports.onPullToRefresh = onPullToRefresh;
     exports.onReady = onReady;
     exports.onResume = onResume;
+    exports.optionMenu = optionMenu$1;
     exports.popWindow = popWindow$2;
     exports.pushWindow = pushWindow$2;
     exports.qianniu = qianniu;




diff --git a/dist/koubei/index.d.ts b/dist/koubei/index.d.ts
index aa224b2241b2812ac46ed0eec409a5f9ae8e4edf..dfe307f0b561df5e8155098a5b28156ba35a9657 100644
--- a/dist/koubei/index.d.ts
+++ b/dist/koubei/index.d.ts
@@ -105,10 +105,26 @@
 declare const closeWebview: () => Promise<any>;
 
     type: 'none' | 'success' | 'fail' | 'exception';
+    duration: number;
+    icontype?: "scan" | "user";
+    redDot?: string;
+};
+declare type OptionMenuType = {
+    menus: Array<OptionMenuItem>;
+    override?: boolean;
+};
+/**
+ * https://myjsapi.alipay.com/jsapi/events/option-menu.html
+ */
+    duration: number;
 
+declare const hideOptionMenu: () => void;
 
     type: 'none' | 'success' | 'fail' | 'exception';
-declare type ToastOption = {
+
 
     type: 'none' | 'success' | 'fail' | 'exception';
+declare type ToastOption = {
+
+    duration: number;
     type: 'none' | 'success' | 'fail' | 'exception';




diff --git a/dist/koubei/index.js b/dist/koubei/index.js
index e6e528c17ea05a90bb5694ba609b7746d10556fa..e97e8adb4263cf266c11247174bd78607418ae63 100644
--- a/dist/koubei/index.js
+++ b/dist/koubei/index.js
@@ -175,6 +175,25 @@     return pcall('closeWebview');
 };
 
 'use strict';
+    return new Promise(function (resolve, reject) {
+    document.addEventListener(type, fn, false);
+    return function () { return document.removeEventListener(type, fn); };
+};
+
+/**
+ * https://myjsapi.alipay.com/jsapi/events/option-menu.html
+ */
+var optionMenu = function (options, fn) {
+    call('setOptionMenu', options);
+    call('showOptionMenu');
+    addEventListener('optionMenu', fn);
+    return hideOptionMenu;
+};
+var hideOptionMenu = function () {
+    return call('hideOptionMenu');
+};
+
+'use strict';
     };

     return pcall('openInBrowser', { url: url });
 };
@@ -192,7 +211,10 @@ exports.handleResponse = handleResponse;
 exports.hideBackButton = hideBackButton;
 exports.hideLoading = hideLoading;
 'use strict';
+var toast = function (content, options) {
+'use strict';
     if (window.AlipayJSBridge) {
+exports.optionMenu = optionMenu;
 exports.pcall = pcall;
 exports.popWindow = popWindow;
 exports.pushWindow = pushWindow;




diff --git a/dist/mybank/index.d.ts b/dist/mybank/index.d.ts
index aa224b2241b2812ac46ed0eec409a5f9ae8e4edf..dfe307f0b561df5e8155098a5b28156ba35a9657 100644
--- a/dist/mybank/index.d.ts
+++ b/dist/mybank/index.d.ts
@@ -105,10 +105,26 @@
 declare const closeWebview: () => Promise<any>;
 
     type: 'none' | 'success' | 'fail' | 'exception';
+    duration: number;
+    icontype?: "scan" | "user";
+    redDot?: string;
+};
+declare type OptionMenuType = {
+    menus: Array<OptionMenuItem>;
+    override?: boolean;
+};
+/**
+ * https://myjsapi.alipay.com/jsapi/events/option-menu.html
+ */
+    duration: number;
 
+declare const hideOptionMenu: () => void;
 
     type: 'none' | 'success' | 'fail' | 'exception';
-declare type ToastOption = {
+
 
     type: 'none' | 'success' | 'fail' | 'exception';
+declare type ToastOption = {
+
+    duration: number;
     type: 'none' | 'success' | 'fail' | 'exception';




diff --git a/dist/mybank/index.js b/dist/mybank/index.js
index e6e528c17ea05a90bb5694ba609b7746d10556fa..e97e8adb4263cf266c11247174bd78607418ae63 100644
--- a/dist/mybank/index.js
+++ b/dist/mybank/index.js
@@ -175,6 +175,25 @@     return pcall('closeWebview');
 };
 
 'use strict';
+    return new Promise(function (resolve, reject) {
+    document.addEventListener(type, fn, false);
+    return function () { return document.removeEventListener(type, fn); };
+};
+
+/**
+ * https://myjsapi.alipay.com/jsapi/events/option-menu.html
+ */
+var optionMenu = function (options, fn) {
+    call('setOptionMenu', options);
+    call('showOptionMenu');
+    addEventListener('optionMenu', fn);
+    return hideOptionMenu;
+};
+var hideOptionMenu = function () {
+    return call('hideOptionMenu');
+};
+
+'use strict';
     };

     return pcall('openInBrowser', { url: url });
 };
@@ -192,7 +211,10 @@ exports.handleResponse = handleResponse;
 exports.hideBackButton = hideBackButton;
 exports.hideLoading = hideLoading;
 'use strict';
+var toast = function (content, options) {
+'use strict';
     if (window.AlipayJSBridge) {
+exports.optionMenu = optionMenu;
 exports.pcall = pcall;
 exports.popWindow = popWindow;
 exports.pushWindow = pushWindow;




diff --git a/package.json b/package.json
index 176789b7a9578dbdf948ecfe4f3973ed8ee0593e..46af83b452ee2527d20b39c10f9131ad926045f5 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@alipay/flyover",
-  "version": "0.0.6",
+  "version": "0.0.7",
   "description": "flyover",
   "main": "./dist/flyover.js",
   "scripts": {




diff --git a/src/index.ts b/src/index.ts
index 948ce6e907d72793347caefb3ea8c59219abab95..13ef7de568f63fa89a63fa6188c896324f2ccff1 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -81,6 +81,20 @@ export const getTitleAndStatusbarHeight = (): Promise => {
   return call('getTitleAndStatusbarHeight');
 };
 
+type OptionMenuItem = {
+  icontype?: "scan" | "user",
+  redDot?: string,
+};
+
+type OptionMenuType = {
+  menus: Array<OptionMenuItem>,
+  override?: boolean,
+};
+
+export const optionMenu = (options: OptionMenuItem | OptionMenuType, fn: EventHandler) => {
+  return call('optionMenu', options, fn);
+};
+
 export interface EventHandler {
   (event: any): void
 }




diff --git a/src/nebula/index.ts b/src/nebula/index.ts
index d35abf2cd56ee815d62615cc9ee3ba444fc16383..082d0735f4df7cf635f0ed5139b0729ef4c50a73 100644
--- a/src/nebula/index.ts
+++ b/src/nebula/index.ts
@@ -8,4 +8,6 @@ export * from './popWindow';
 export * from './pushWindow';
 export * from './closeWebview';
 export * from './core';
+export * from './toast';
+export * from './core';
 export * from './pullToRefresh';




diff --git a/types/index.d.ts b/types/index.d.ts
index 6c35a8a9de48906685421a328230aa61c2aa682f..e207a3d4b3b3ae20e118e82f5df393abd8c3c1dc 100644
--- a/types/index.d.ts
+++ b/types/index.d.ts
@@ -181,6 +181,20 @@ declare const pushWindow: (url: string, param?: PushWindowParam) => Promise;
 
 declare const closeWebview: () => Promise<any>;
 
+declare type OptionMenuItem = {
+    icontype?: "scan" | "user";
+    redDot?: string;
+};
+declare type OptionMenuType = {
+    menus: Array<OptionMenuItem>;
+    override?: boolean;
+};
+/**
+ * https://myjsapi.alipay.com/jsapi/events/option-menu.html
+ */
+declare const optionMenu: (options: OptionMenuItem | OptionMenuType, fn: any) => () => void;
+declare const hideOptionMenu: () => void;
+
 declare const openInBrowser: (url: string) => Promise<any>;
 
 declare const restorePullToRefresh: () => Promise<any>;
@@ -198,6 +212,8 @@ declare const index$1_showBackButton: typeof showBackButton;
 declare const index$1_popWindow: typeof popWindow;
 declare const index$1_pushWindow: typeof pushWindow;
 declare const index$1_closeWebview: typeof closeWebview;
+declare const index$1_optionMenu: typeof optionMenu;
+declare const index$1_hideOptionMenu: typeof hideOptionMenu;
 declare const index$1_openInBrowser: typeof openInBrowser;
 declare const index$1_restorePullToRefresh: typeof restorePullToRefresh;
 declare namespace index$1 {
@@ -220,6 +236,8 @@     hideLoading$1 as hideLoading,
     index$1_popWindow as popWindow,
     index$1_pushWindow as pushWindow,
     index$1_closeWebview as closeWebview,
+    index$1_optionMenu as optionMenu,
+    index$1_hideOptionMenu as hideOptionMenu,
     index$1_openInBrowser as openInBrowser,
     index$1_restorePullToRefresh as restorePullToRefresh,
   };
@@ -238,6 +256,8 @@ declare const index$2_showBackButton: typeof showBackButton;
 declare const index$2_popWindow: typeof popWindow;
 declare const index$2_pushWindow: typeof pushWindow;
 declare const index$2_closeWebview: typeof closeWebview;
+declare const index$2_optionMenu: typeof optionMenu;
+declare const index$2_hideOptionMenu: typeof hideOptionMenu;
 declare const index$2_openInBrowser: typeof openInBrowser;
 declare const index$2_restorePullToRefresh: typeof restorePullToRefresh;
 declare namespace index$2 {
@@ -260,6 +280,8 @@     hideLoading$1 as hideLoading,
     index$2_popWindow as popWindow,
     index$2_pushWindow as pushWindow,
     index$2_closeWebview as closeWebview,
+    index$2_optionMenu as optionMenu,
+    index$2_hideOptionMenu as hideOptionMenu,
     index$2_openInBrowser as openInBrowser,
     index$2_restorePullToRefresh as restorePullToRefresh,
   };
@@ -278,6 +300,8 @@ declare const index$3_showBackButton: typeof showBackButton;
 declare const index$3_popWindow: typeof popWindow;
 declare const index$3_pushWindow: typeof pushWindow;
 declare const index$3_closeWebview: typeof closeWebview;
+declare const index$3_optionMenu: typeof optionMenu;
+declare const index$3_hideOptionMenu: typeof hideOptionMenu;
 declare const index$3_openInBrowser: typeof openInBrowser;
 declare const index$3_restorePullToRefresh: typeof restorePullToRefresh;
 declare namespace index$3 {
@@ -300,6 +324,8 @@     hideLoading$1 as hideLoading,
     index$3_popWindow as popWindow,
     index$3_pushWindow as pushWindow,
     index$3_closeWebview as closeWebview,
+    index$3_optionMenu as optionMenu,
+    index$3_hideOptionMenu as hideOptionMenu,
     index$3_openInBrowser as openInBrowser,
     index$3_restorePullToRefresh as restorePullToRefresh,
   };
@@ -366,6 +392,15 @@ declare const setTitle$1: (title: any) => any;
 declare const setTitleColor$1: (color: any, reset?: any) => any;
 declare const setTransparentTitle$1: (options?: TransparentTitleOption$1) => any;
 declare const getTitleAndStatusbarHeight$1: () => Promise<TitleAndStatusbarHeightType$1>;
+declare type OptionMenuItem$1 = {
+    icontype?: "scan" | "user";
+    redDot?: string;
+};
+declare type OptionMenuType$1 = {
+    menus: Array<OptionMenuItem$1>;
+    override?: boolean;
+};
+declare const optionMenu$1: (options: OptionMenuItem$1 | OptionMenuType$1, fn: EventHandler) => any;
 interface EventHandler {
     (event: any): void;
 }
@@ -380,5 +415,5 @@  * @docs http://jsapi.alipay.net/jsapi/events/fire-pull-to-refresh.html
  */
 declare const onPullToRefresh: (fn: EventHandler) => void;
 
-    detect_isAlipay as isAlipay,
 declare const isKoubei: boolean;
+declare const detect_isTmall: typeof isTmall;