1.2.24 • Published 24 days ago

@yolanda-qn/jsbridge v1.2.24

Weekly downloads
-
License
MIT
Repository
-
Last release
24 days ago

@yolanda-qn/jsbridge

jsbridge基建库,新海外和国内新app共用

安装

yarn add @yolanda-qn/jsbridge -S

使用

初始化

import jsbridge from '@yolanda-qn/jsbridge';
// 业务中的代码进行判断是安卓还是iOS
import { platformIsIos } from '@/libs/system-info';

// 判断当前手机系统是安卓还是iOS platformIsIos
export default jsbridge(platformIsIos ? 'ios' : 'android');

类型扩展

注意如果是业务代码则在项目本身中进行类型扩展。 如果是基建扩展,则在基建项目中进行扩展,并更新版本号。

业务类型扩展

declare module '@yolanda-qn/jsbridge' {
  // 业务定义方法
  export declare interface JsbridgeOc {
    setDataPoint(params: JsbridgeParams.SetDataPoint): JsbridgeDefaultResult;
  }
  
  // 业务使用参数
  export declare namespace JsbridgeParams {
    interface SetDataPoint {
      key: string,
      data?: Record<string, string | number>,
    }
  }

  // 业务方法结果参数
  export declare namespace JsbridgeResult { }

  // 在原有的基础Jsbridge上扩展业务Jsbridge
  export interface JsbridgeOc {
  }
}

业务中使用

import jsbridge from '@/libs/jsbridge';

jsbridge.call('voiceInteractionBroadcast', { content });
1.2.24

24 days ago

1.2.23

3 months ago

1.2.22

3 months ago

1.2.18

7 months ago

1.2.13

9 months ago

1.2.16

9 months ago

1.2.17

9 months ago

1.2.14

9 months ago

1.2.15

9 months ago

1.2.12

11 months ago

1.2.10

1 year ago

1.2.11

11 months ago

1.2.8

1 year ago

1.2.0

1 year ago

1.2.7

1 year ago

1.2.6

1 year ago

1.2.5

1 year ago

1.2.4

1 year ago

1.2.3

1 year ago

1.2.2

1 year ago

1.2.1

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago