@byhealth/native-app-jssdk
Advanced tools
Comparing version 2.0.0-alpha.4 to 2.0.0-rc.1
@@ -1,6 +0,1 @@ | ||
/** | ||
* BY-Health Front-end Team (https://www.by-health.com/) | ||
* | ||
* Copyright © 2016-present By-Health Co Ltd. All rights reserved. | ||
*/ | ||
import { ShareInfo, UserInfo } from './types/MemberAppJs'; | ||
@@ -12,3 +7,3 @@ /** | ||
/** | ||
* 返回上一级页面,如果没有上一级页面,则关闭当前页面(Android不关闭)。 | ||
* 返回上一级页面,如果没有上一级页面,则关闭当前页面。 | ||
*/ | ||
@@ -21,2 +16,8 @@ export declare function goBack(): void; | ||
/** | ||
* 打开原生视图窗口 | ||
* @param android Android视图名称 | ||
* @param ios iOS视图名称 | ||
*/ | ||
export declare function openNativeView(android: string, ios: string): void; | ||
/** | ||
* 设置窗口标题 | ||
@@ -23,0 +24,0 @@ * @param title 标题内容 |
"use strict"; | ||
/** | ||
/* | ||
* BY-Health Front-end Team (https://www.by-health.com/) | ||
@@ -28,3 +28,3 @@ * | ||
/** | ||
* 返回上一级页面,如果没有上一级页面,则关闭当前页面(Android不关闭)。 | ||
* 返回上一级页面,如果没有上一级页面,则关闭当前页面。 | ||
*/ | ||
@@ -43,2 +43,11 @@ function goBack() { | ||
/** | ||
* 打开原生视图窗口 | ||
* @param android Android视图名称 | ||
* @param ios iOS视图名称 | ||
*/ | ||
function openNativeView(android, ios) { | ||
nativeBridge_1.default('openAppActivity', nativeBridge_1.isAndroid ? android : ios); | ||
} | ||
exports.openNativeView = openNativeView; | ||
/** | ||
* 设置窗口标题 | ||
@@ -201,2 +210,8 @@ * @param title 标题内容 | ||
exports.userInfo = userInfo; | ||
/** | ||
* 提示接口过时 | ||
* @param before | ||
* @param after | ||
* @ignore | ||
*/ | ||
function deprecated(before, after) { | ||
@@ -203,0 +218,0 @@ // tslint:disable-next-line |
/** | ||
* BY-Health Front-end Team (https://www.by-health.com/) | ||
* | ||
* Copyright © 2016-present By-Health Co Ltd. All rights reserved. | ||
*/ | ||
/** | ||
* Create a callback function proxy in Window and return the callback name. | ||
* @param fn Callback function. | ||
* @param once Execute only once. | ||
* @ignore | ||
*/ | ||
declare function createCallback(fn: (args: any) => void, once?: boolean): string; | ||
export default createCallback; |
"use strict"; | ||
/** | ||
/* | ||
* BY-Health Front-end Team (https://www.by-health.com/) | ||
@@ -8,2 +8,6 @@ * | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/** | ||
* 回调函数Id | ||
* @ignore | ||
*/ | ||
var cbIdentity = 0; | ||
@@ -14,2 +18,3 @@ /** | ||
* @param once Execute only once. | ||
* @ignore | ||
*/ | ||
@@ -16,0 +21,0 @@ function createCallback(fn, once) { |
@@ -0,7 +1,5 @@ | ||
import MemberAppJs from '../types/MemberAppJs'; | ||
/** | ||
* BY-Health Front-end Team (https://www.by-health.com/) | ||
* | ||
* Copyright © 2016-present By-Health Co Ltd. All rights reserved. | ||
* @ignore | ||
*/ | ||
import MemberAppJs from '../types/MemberAppJs'; | ||
declare global { | ||
@@ -13,8 +11,23 @@ interface Window { | ||
} | ||
/** | ||
* 是否App的Webview | ||
* @ignore | ||
*/ | ||
declare const isAppWebview: boolean; | ||
/** | ||
* 是否是Android环境 | ||
* @ignore | ||
*/ | ||
declare const isAndroid: boolean; | ||
/** | ||
* 是否是iOS环境 | ||
* @ignore | ||
*/ | ||
declare const isIOS: boolean; | ||
/** | ||
* Call the app native interface. | ||
* @ignore | ||
*/ | ||
declare function nativeBridge(api: string, ...args: any): void; | ||
export { isAppWebview }; | ||
export { isAppWebview, isAndroid, isIOS }; | ||
export default nativeBridge; |
"use strict"; | ||
/* | ||
* BY-Health Front-end Team (https://www.by-health.com/) | ||
* | ||
* Copyright © 2016-present By-Health Co Ltd. All rights reserved. | ||
*/ | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/** | ||
* 全局对象 | ||
* @ignore | ||
*/ | ||
var global = window || {}; | ||
/** | ||
* UserAgent | ||
* @ignore | ||
*/ | ||
var userAgent = (global.navigator && global.navigator.userAgent) || ''; | ||
/** | ||
* 自定义协议 | ||
* @ignore | ||
*/ | ||
var nativeProtocol = 'js-call://'; | ||
/** | ||
* 自定义注入对象 | ||
* @ignore | ||
*/ | ||
var nativeJSBridge = global.MemberAppJs || global.memberApp || {}; | ||
var isAppWebview = Boolean(global.navigator && global.navigator.userAgent && global.navigator.userAgent.match(/byhealth/gi)); | ||
/** | ||
* 是否App的Webview | ||
* @ignore | ||
*/ | ||
var isAppWebview = Boolean(userAgent.match(/byhealth/gi)); | ||
exports.isAppWebview = isAppWebview; | ||
/** | ||
* 是否是Android环境 | ||
* @ignore | ||
*/ | ||
var isAndroid = Boolean(userAgent.match(/android/gi)); | ||
exports.isAndroid = isAndroid; | ||
/** | ||
* 是否是iOS环境 | ||
* @ignore | ||
*/ | ||
var isIOS = Boolean(userAgent.match(/iphone|ipod|ipad/gi)); | ||
exports.isIOS = isIOS; | ||
/** | ||
* Call the app native interface. | ||
* @ignore | ||
*/ | ||
@@ -11,0 +50,0 @@ function nativeBridge(api) { |
@@ -1,2 +0,2 @@ | ||
/** | ||
/* | ||
* BY-Health Front-end Team (https://www.by-health.com/) | ||
@@ -7,3 +7,3 @@ * | ||
import createCallback from './lib/createCallback'; | ||
import nativeBridge, { isAppWebview } from './lib/nativeBridge'; | ||
import nativeBridge, { isAppWebview, isAndroid } from './lib/nativeBridge'; | ||
/** | ||
@@ -16,3 +16,3 @@ * 当前是否在App环境 | ||
/** | ||
* 返回上一级页面,如果没有上一级页面,则关闭当前页面(Android不关闭)。 | ||
* 返回上一级页面,如果没有上一级页面,则关闭当前页面。 | ||
*/ | ||
@@ -29,2 +29,10 @@ export function goBack() { | ||
/** | ||
* 打开原生视图窗口 | ||
* @param android Android视图名称 | ||
* @param ios iOS视图名称 | ||
*/ | ||
export function openNativeView(android, ios) { | ||
nativeBridge('openAppActivity', isAndroid ? android : ios); | ||
} | ||
/** | ||
* 设置窗口标题 | ||
@@ -169,2 +177,8 @@ * @param title 标题内容 | ||
} | ||
/** | ||
* 提示接口过时 | ||
* @param before | ||
* @param after | ||
* @ignore | ||
*/ | ||
function deprecated(before, after) { | ||
@@ -171,0 +185,0 @@ // tslint:disable-next-line |
@@ -1,2 +0,2 @@ | ||
/** | ||
/* | ||
* BY-Health Front-end Team (https://www.by-health.com/) | ||
@@ -6,2 +6,6 @@ * | ||
*/ | ||
/** | ||
* 回调函数Id | ||
* @ignore | ||
*/ | ||
var cbIdentity = 0; | ||
@@ -12,2 +16,3 @@ /** | ||
* @param once Execute only once. | ||
* @ignore | ||
*/ | ||
@@ -14,0 +19,0 @@ function createCallback(fn, once) { |
@@ -0,7 +1,44 @@ | ||
/* | ||
* BY-Health Front-end Team (https://www.by-health.com/) | ||
* | ||
* Copyright © 2016-present By-Health Co Ltd. All rights reserved. | ||
*/ | ||
/** | ||
* 全局对象 | ||
* @ignore | ||
*/ | ||
var global = window || {}; | ||
/** | ||
* UserAgent | ||
* @ignore | ||
*/ | ||
var userAgent = (global.navigator && global.navigator.userAgent) || ''; | ||
/** | ||
* 自定义协议 | ||
* @ignore | ||
*/ | ||
var nativeProtocol = 'js-call://'; | ||
/** | ||
* 自定义注入对象 | ||
* @ignore | ||
*/ | ||
var nativeJSBridge = global.MemberAppJs || global.memberApp || {}; | ||
var isAppWebview = Boolean(global.navigator && global.navigator.userAgent && global.navigator.userAgent.match(/byhealth/gi)); | ||
/** | ||
* 是否App的Webview | ||
* @ignore | ||
*/ | ||
var isAppWebview = Boolean(userAgent.match(/byhealth/gi)); | ||
/** | ||
* 是否是Android环境 | ||
* @ignore | ||
*/ | ||
var isAndroid = Boolean(userAgent.match(/android/gi)); | ||
/** | ||
* 是否是iOS环境 | ||
* @ignore | ||
*/ | ||
var isIOS = Boolean(userAgent.match(/iphone|ipod|ipad/gi)); | ||
/** | ||
* Call the app native interface. | ||
* @ignore | ||
*/ | ||
@@ -35,3 +72,3 @@ function nativeBridge(api) { | ||
} | ||
export { isAppWebview }; | ||
export { isAppWebview, isAndroid, isIOS }; | ||
export default nativeBridge; |
@@ -191,2 +191,5 @@ /* | ||
})(RoleType || (RoleType = {})); | ||
/** | ||
* 用户性别 | ||
*/ | ||
export var Gender; | ||
@@ -193,0 +196,0 @@ (function (Gender) { |
@@ -162,2 +162,5 @@ /** | ||
} | ||
/** | ||
* 用户性别 | ||
*/ | ||
export declare enum Gender { | ||
@@ -173,4 +176,13 @@ /** | ||
} | ||
/** | ||
* 用户信息 | ||
*/ | ||
export interface UserInfo { | ||
/** | ||
* 角色类型 | ||
*/ | ||
roleType: RoleType; | ||
/** | ||
* 用户信息 | ||
*/ | ||
user: { | ||
@@ -185,2 +197,5 @@ usertel: string; | ||
}; | ||
/** | ||
* 用户扩展信息 | ||
*/ | ||
userExt: { | ||
@@ -199,2 +214,5 @@ /** | ||
storeNum: string; | ||
/** | ||
* 用户昵称 | ||
*/ | ||
userName: string; | ||
@@ -217,2 +235,5 @@ /** | ||
}; | ||
/** | ||
* 门店信息 | ||
*/ | ||
store: { | ||
@@ -236,2 +257,5 @@ /** | ||
} | ||
/** | ||
* 分享信息 | ||
*/ | ||
export interface ShareInfo { | ||
@@ -243,4 +267,8 @@ title: string; | ||
} | ||
/** | ||
* Java native bridge | ||
* @ignore | ||
*/ | ||
export default interface MemberAppJs { | ||
[api: string]: (...args: any) => void; | ||
} |
@@ -193,2 +193,5 @@ "use strict"; | ||
})(RoleType = exports.RoleType || (exports.RoleType = {})); | ||
/** | ||
* 用户性别 | ||
*/ | ||
var Gender; | ||
@@ -195,0 +198,0 @@ (function (Gender) { |
{ | ||
"name": "@byhealth/native-app-jssdk", | ||
"version": "2.0.0-alpha.4", | ||
"version": "2.0.0-rc.1", | ||
"description": "By-Health Native App Jssdk.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -34,2 +34,6 @@ # By-Health Native App Jssdk | ||
[文档地址](https://by-healthfed.github.io/native-app-jssdk/globals.html#alert) | ||
[文档地址](https://by-healthfed.github.io/native-app-jssdk/) | ||
## FAQ | ||
- Android的 scanQrCode 方法会去掉防伪码前面的url,而iOS不会; | ||
- Android和iOS不允许重复调用 playMusic 播放音乐; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
74085
1438
39