@lambo-design-mobile/lambo-js-bridge 1.0.0-beta.30 → 1.0.0-beta.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,102 +1,102 @@
1
- /* eslint-disable prefer-destructuring */
2
- import WechatAdapter from './WechatAdapter';
3
- import DingTalkAdapter from './DingTalkAdapter';
4
- import CordovaAdapter from './CordovaAdapter';
5
- import YunTuAdapter from './YunTuAdapter';
6
- import WeComAdapter from './WeComAdapter';
7
- import BrowserAdapter from './BrowserAdapter';
8
- import MobileIMAdaoter from './MobileIMAdaoter';
9
-
10
- class LamboJsBridge {
11
- constructor(param) {
12
- this._detectPlatform(param);
13
- }
14
-
15
- _detectPlatform(param) {
16
- let userAgent;
17
- if (param.userAgent) {
18
- userAgent = param.userAgent;
19
- } else {
20
- userAgent = navigator.userAgent.toLowerCase();
21
- }
22
- if (/wxwork/.test(userAgent)) {
23
- this.platform = new WeComAdapter(param);
24
- } else if (/micromessenger/.test(userAgent)) {
25
- this.platform = new WechatAdapter(param);
26
- } else if (/dingtalk/.test(userAgent)) {
27
- this.platform = new DingTalkAdapter(param);
28
- } else if (/cordova/.test(userAgent)) {
29
- this.platform = new CordovaAdapter(param);
30
- } else if (/yuntu/.test(userAgent)) {
31
- this.platform = new YunTuAdapter(param);
32
- } else if (/mobileim/.test(userAgent)) {
33
- this.platform = new MobileIMAdaoter(param);
34
- } else {
35
- this.platform = new BrowserAdapter();
36
- }
37
- }
38
-
39
- async initializePlugin(pluginConfig = []) {
40
- if (this.platform instanceof YunTuAdapter) {
41
- return this.platform.initializePlugin(pluginConfig);
42
- }
43
- return Promise.resolve();
44
-
45
- }
46
-
47
- async getPlatform(options = {}) {
48
- return this.platform.getPlatform(options);
49
- }
50
-
51
- async getLocation(options = {}) {
52
- return this.platform.getLocation(options);
53
- }
54
-
55
- async scanCode(options = {}) {
56
- return this.platform.scanCode(options);
57
- }
58
-
59
- async localAuthPlugin(options = {}) {
60
- return this.platform.localAuthPlugin(options);
61
- }
62
-
63
- async getAvailableBiometrics(options = {}) {
64
- return this.platform.getAvailableBiometrics(options);
65
- }
66
-
67
- async takePhoto(options = {}) {
68
- return this.platform.takePhoto(options);
69
- }
70
-
71
- async openLocation(options = {}) {
72
- return this.platform.openLocation(options);
73
- }
74
-
75
- async filePreview(options = {}) {
76
- return this.platform.filePreview(options);
77
- }
78
-
79
- async initKey(options = {}) {
80
- return this.platform.initKey(options);
81
- }
82
-
83
- async startRecording(options = {}) {
84
- return this.platform.startRecording(options);
85
- }
86
-
87
- async stopRecording(options = {}) {
88
- return this.platform.stopRecording(options);
89
- }
90
-
91
- async downloadFile(options={}){
92
- return this.platform.downloadFile(options);
93
- }
94
-
95
- // 创建一个 Vue 插件
96
- static install(Vue) {
97
- // 将 LamboJsBridge 实例挂载到 Vue 原型上,全局可用
98
- Vue.prototype.$lamboJsBridge = new LamboJsBridge({});
99
- }
100
- }
101
-
102
- export default LamboJsBridge;
1
+ /* eslint-disable prefer-destructuring */
2
+ import WechatAdapter from './WechatAdapter';
3
+ import DingTalkAdapter from './DingTalkAdapter';
4
+ import CordovaAdapter from './CordovaAdapter';
5
+ import YunTuAdapter from './YunTuAdapter';
6
+ import WeComAdapter from './WeComAdapter';
7
+ import BrowserAdapter from './BrowserAdapter';
8
+ import MobileIMAdaoter from './MobileIMAdaoter';
9
+
10
+ class LamboJsBridge {
11
+ constructor(param) {
12
+ this._detectPlatform(param);
13
+ }
14
+
15
+ _detectPlatform(param) {
16
+ let userAgent;
17
+ if (param.userAgent) {
18
+ userAgent = param.userAgent;
19
+ } else {
20
+ userAgent = navigator.userAgent.toLowerCase();
21
+ }
22
+ if (/wxwork/.test(userAgent)) {
23
+ this.platform = new WeComAdapter(param);
24
+ } else if (/micromessenger/.test(userAgent)) {
25
+ this.platform = new WechatAdapter(param);
26
+ } else if (/dingtalk/.test(userAgent)) {
27
+ this.platform = new DingTalkAdapter(param);
28
+ } else if (/cordova/.test(userAgent)) {
29
+ this.platform = new CordovaAdapter(param);
30
+ } else if (/yuntu/.test(userAgent)) {
31
+ this.platform = new YunTuAdapter(param);
32
+ } else if (/mobileim/.test(userAgent)) {
33
+ this.platform = new MobileIMAdaoter(param);
34
+ } else {
35
+ this.platform = new BrowserAdapter();
36
+ }
37
+ }
38
+
39
+ async initializePlugin(pluginConfig = []) {
40
+ if (this.platform instanceof YunTuAdapter) {
41
+ return this.platform.initializePlugin(pluginConfig);
42
+ }
43
+ return Promise.resolve();
44
+
45
+ }
46
+
47
+ async getPlatform(options = {}) {
48
+ return this.platform.getPlatform(options);
49
+ }
50
+
51
+ async getLocation(options = {}) {
52
+ return this.platform.getLocation(options);
53
+ }
54
+
55
+ async scanCode(options = {}) {
56
+ return this.platform.scanCode(options);
57
+ }
58
+
59
+ async localAuthPlugin(options = {}) {
60
+ return this.platform.localAuthPlugin(options);
61
+ }
62
+
63
+ async getAvailableBiometrics(options = {}) {
64
+ return this.platform.getAvailableBiometrics(options);
65
+ }
66
+
67
+ async takePhoto(options = {}) {
68
+ return this.platform.takePhoto(options);
69
+ }
70
+
71
+ async openLocation(options = {}) {
72
+ return this.platform.openLocation(options);
73
+ }
74
+
75
+ async filePreview(options = {}) {
76
+ return this.platform.filePreview(options);
77
+ }
78
+
79
+ async initKey(options = {}) {
80
+ return this.platform.initKey(options);
81
+ }
82
+
83
+ async startRecording(options = {}) {
84
+ return this.platform.startRecording(options);
85
+ }
86
+
87
+ async stopRecording(options = {}) {
88
+ return this.platform.stopRecording(options);
89
+ }
90
+
91
+ async downloadFile(options={}){
92
+ return this.platform.downloadFile(options);
93
+ }
94
+
95
+ // 创建一个 Vue 插件
96
+ static install(Vue) {
97
+ // 将 LamboJsBridge 实例挂载到 Vue 原型上,全局可用
98
+ Vue.prototype.$lamboJsBridge = new LamboJsBridge({});
99
+ }
100
+ }
101
+
102
+ export default LamboJsBridge;