mobile-web-bridge 0.0.0-stage → 0.1.1
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.
- package/LICENSE +21 -0
- package/README.md +163 -2
- package/THIRD_PARTY_NOTICES.md +34 -0
- package/dist/apiManifest.d.ts +1 -0
- package/dist/assembleMWB.d.ts +15 -0
- package/dist/bridge.d.ts +17 -0
- package/dist/browser.d.ts +1 -0
- package/dist/createMWB.d.ts +14 -0
- package/dist/eventHub.d.ts +13 -0
- package/dist/events.d.ts +3 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +847 -0
- package/dist/mwb.iife.js +831 -0
- package/dist/nativePlugins.d.ts +37 -0
- package/dist/plugins/basic.d.ts +37 -0
- package/dist/plugins/container.d.ts +18 -0
- package/dist/plugins/device.d.ts +15 -0
- package/dist/plugins/media.d.ts +13 -0
- package/dist/plugins/storage.d.ts +10 -0
- package/dist/types.d.ts +550 -0
- package/package.json +53 -4
package/dist/index.js
ADDED
|
@@ -0,0 +1,847 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
MIT License
|
|
3
|
+
|
|
4
|
+
Copyright (c) 2026 gaoxiao228
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
|
23
|
+
|
|
24
|
+
# DSBridge third-party notice
|
|
25
|
+
|
|
26
|
+
DSBridge JavaScript 3.1.4: https://www.npmjs.com/package/dsbridge/v/3.1.4
|
|
27
|
+
DSBridge Android 3.0.0: https://github.com/wendux/DSBridge-Android/tree/d3e5ebc6ca8170f97e420f2f482680c8e149b471
|
|
28
|
+
DSBridge iOS 3.0.6: https://github.com/wendux/DSBridge-IOS/tree/f0e3c724dd362800528f8b6c788bdad7006cc187
|
|
29
|
+
|
|
30
|
+
Author: wendux (杜文 / Du Wen), as identified by upstream package metadata and source.
|
|
31
|
+
The upstream npm metadata, Android readme.md and iOS podspec declare MIT.
|
|
32
|
+
The pinned native trees do not provide a separate LICENSE file; the MIT terms
|
|
33
|
+
are reproduced below without inventing an absent upstream copyright notice.
|
|
34
|
+
Original iOS source notices are retained verbatim:
|
|
35
|
+
|
|
36
|
+
Copyright © 2016年 杜文. All rights reserved.
|
|
37
|
+
Copyright © 2018年 杜文. All rights reserved.
|
|
38
|
+
|
|
39
|
+
MIT License
|
|
40
|
+
|
|
41
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
42
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
43
|
+
in the Software without restriction, including without limitation the rights
|
|
44
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
45
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
46
|
+
furnished to do so, subject to the following conditions:
|
|
47
|
+
|
|
48
|
+
The above copyright notice and this permission notice shall be included in all
|
|
49
|
+
copies or substantial portions of the Software.
|
|
50
|
+
|
|
51
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
52
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
53
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
54
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
55
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
56
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
57
|
+
SOFTWARE.
|
|
58
|
+
|
|
59
|
+
*/
|
|
60
|
+
var __create = Object.create;
|
|
61
|
+
var __defProp = Object.defineProperty;
|
|
62
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
63
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
64
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
65
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
66
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
67
|
+
try {
|
|
68
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
69
|
+
} catch (e) {
|
|
70
|
+
throw mod = 0, e;
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
var __copyProps = (to, from, except, desc) => {
|
|
74
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
75
|
+
for (let key of __getOwnPropNames(from))
|
|
76
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
77
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
78
|
+
}
|
|
79
|
+
return to;
|
|
80
|
+
};
|
|
81
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
82
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
83
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
84
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
85
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
86
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
87
|
+
mod
|
|
88
|
+
));
|
|
89
|
+
|
|
90
|
+
// node_modules/dsbridge/index.js
|
|
91
|
+
var require_dsbridge = __commonJS({
|
|
92
|
+
"node_modules/dsbridge/index.js"(exports, module) {
|
|
93
|
+
var bridge = {
|
|
94
|
+
default: exports,
|
|
95
|
+
// for typescript
|
|
96
|
+
call: function(method, args, cb) {
|
|
97
|
+
var ret = "";
|
|
98
|
+
if (typeof args == "function") {
|
|
99
|
+
cb = args;
|
|
100
|
+
args = {};
|
|
101
|
+
}
|
|
102
|
+
var arg = { data: args === void 0 ? null : args };
|
|
103
|
+
if (typeof cb == "function") {
|
|
104
|
+
var cbName = "dscb" + window.dscb++;
|
|
105
|
+
window[cbName] = cb;
|
|
106
|
+
arg["_dscbstub"] = cbName;
|
|
107
|
+
}
|
|
108
|
+
arg = JSON.stringify(arg);
|
|
109
|
+
if (window._dsbridge) {
|
|
110
|
+
ret = _dsbridge.call(method, arg);
|
|
111
|
+
} else if (window._dswk || navigator.userAgent.indexOf("_dsbridge") != -1) {
|
|
112
|
+
ret = prompt("_dsbridge=" + method, arg);
|
|
113
|
+
}
|
|
114
|
+
return JSON.parse(ret || "{}").data;
|
|
115
|
+
},
|
|
116
|
+
register: function(name, fun, asyn) {
|
|
117
|
+
var q = asyn ? window._dsaf : window._dsf;
|
|
118
|
+
if (!window._dsInit) {
|
|
119
|
+
window._dsInit = true;
|
|
120
|
+
setTimeout(function() {
|
|
121
|
+
bridge.call("_dsb.dsinit");
|
|
122
|
+
}, 0);
|
|
123
|
+
}
|
|
124
|
+
if (typeof fun == "object") {
|
|
125
|
+
q._obs[name] = fun;
|
|
126
|
+
} else {
|
|
127
|
+
q[name] = fun;
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
registerAsyn: function(name, fun) {
|
|
131
|
+
this.register(name, fun, true);
|
|
132
|
+
},
|
|
133
|
+
hasNativeMethod: function(name, type) {
|
|
134
|
+
return this.call("_dsb.hasNativeMethod", { name, type: type || "all" });
|
|
135
|
+
},
|
|
136
|
+
disableJavascriptDialogBlock: function(disable) {
|
|
137
|
+
this.call("_dsb.disableJavascriptDialogBlock", {
|
|
138
|
+
disable: disable !== false
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
!(function() {
|
|
143
|
+
if (window._dsf) return;
|
|
144
|
+
var ob = {
|
|
145
|
+
_dsf: {
|
|
146
|
+
_obs: {}
|
|
147
|
+
},
|
|
148
|
+
_dsaf: {
|
|
149
|
+
_obs: {}
|
|
150
|
+
},
|
|
151
|
+
dscb: 0,
|
|
152
|
+
dsBridge: bridge,
|
|
153
|
+
close: function() {
|
|
154
|
+
bridge.call("_dsb.closePage");
|
|
155
|
+
},
|
|
156
|
+
_handleMessageFromNative: function(info) {
|
|
157
|
+
var arg = JSON.parse(info.data);
|
|
158
|
+
var ret = {
|
|
159
|
+
id: info.callbackId,
|
|
160
|
+
complete: true
|
|
161
|
+
};
|
|
162
|
+
var f = this._dsf[info.method];
|
|
163
|
+
var af = this._dsaf[info.method];
|
|
164
|
+
var callSyn = function(f2, ob3) {
|
|
165
|
+
ret.data = f2.apply(ob3, arg);
|
|
166
|
+
bridge.call("_dsb.returnValue", ret);
|
|
167
|
+
};
|
|
168
|
+
var callAsyn = function(f2, ob3) {
|
|
169
|
+
arg.push(function(data, complete) {
|
|
170
|
+
ret.data = data;
|
|
171
|
+
ret.complete = complete !== false;
|
|
172
|
+
bridge.call("_dsb.returnValue", ret);
|
|
173
|
+
});
|
|
174
|
+
f2.apply(ob3, arg);
|
|
175
|
+
};
|
|
176
|
+
if (f) {
|
|
177
|
+
callSyn(f, this._dsf);
|
|
178
|
+
} else if (af) {
|
|
179
|
+
callAsyn(af, this._dsaf);
|
|
180
|
+
} else {
|
|
181
|
+
var name = info.method.split(".");
|
|
182
|
+
if (name.length < 2) return;
|
|
183
|
+
var method = name.pop();
|
|
184
|
+
var namespace = name.join(".");
|
|
185
|
+
var obs = this._dsf._obs;
|
|
186
|
+
var ob2 = obs[namespace] || {};
|
|
187
|
+
var m = ob2[method];
|
|
188
|
+
if (m && typeof m == "function") {
|
|
189
|
+
callSyn(m, ob2);
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
obs = this._dsaf._obs;
|
|
193
|
+
ob2 = obs[namespace] || {};
|
|
194
|
+
m = ob2[method];
|
|
195
|
+
if (m && typeof m == "function") {
|
|
196
|
+
callAsyn(m, ob2);
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
for (var attr in ob) {
|
|
203
|
+
window[attr] = ob[attr];
|
|
204
|
+
}
|
|
205
|
+
bridge.register("_hasJavascriptMethod", function(method, tag) {
|
|
206
|
+
var name = method.split(".");
|
|
207
|
+
if (name.length < 2) {
|
|
208
|
+
return !!(_dsf[name] || _dsaf[name]);
|
|
209
|
+
} else {
|
|
210
|
+
var method = name.pop();
|
|
211
|
+
var namespace = name.join(".");
|
|
212
|
+
var ob2 = _dsf._obs[namespace] || _dsaf._obs[namespace];
|
|
213
|
+
return ob2 && !!ob2[method];
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
})();
|
|
217
|
+
module.exports = bridge;
|
|
218
|
+
}
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
// src/index.ts
|
|
222
|
+
var import_dsbridge = __toESM(require_dsbridge(), 1);
|
|
223
|
+
|
|
224
|
+
// src/types.ts
|
|
225
|
+
var version = "0.1.1";
|
|
226
|
+
|
|
227
|
+
// src/eventHub.ts
|
|
228
|
+
var hubs = /* @__PURE__ */ new WeakMap();
|
|
229
|
+
var EventHub = class {
|
|
230
|
+
constructor(bridge) {
|
|
231
|
+
this.bridge = bridge;
|
|
232
|
+
this.listeners = /* @__PURE__ */ new Map();
|
|
233
|
+
bridge.register?.("mwb.backBtnPressed", () => this.back?.handler() ?? false);
|
|
234
|
+
}
|
|
235
|
+
on(name, handler) {
|
|
236
|
+
let listeners = this.listeners.get(name);
|
|
237
|
+
if (!listeners) {
|
|
238
|
+
listeners = /* @__PURE__ */ new Set();
|
|
239
|
+
this.listeners.set(name, listeners);
|
|
240
|
+
this.bridge.register?.(name, (...args) => {
|
|
241
|
+
for (const callback of [...this.listeners.get(name) ?? []]) {
|
|
242
|
+
try {
|
|
243
|
+
callback(...args);
|
|
244
|
+
} catch (error) {
|
|
245
|
+
console.error("MWB event listener failed", error);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
listeners.add(handler);
|
|
251
|
+
return () => {
|
|
252
|
+
listeners.delete(handler);
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
setBack(owner, handler) {
|
|
256
|
+
if (handler) this.back = { owner, handler };
|
|
257
|
+
else if (this.back?.owner === owner) this.back = void 0;
|
|
258
|
+
}
|
|
259
|
+
};
|
|
260
|
+
function getEventHub(bridge) {
|
|
261
|
+
let hub = hubs.get(bridge);
|
|
262
|
+
if (!hub) {
|
|
263
|
+
hub = new EventHub(bridge);
|
|
264
|
+
hubs.set(bridge, hub);
|
|
265
|
+
}
|
|
266
|
+
return hub;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
// src/events.ts
|
|
270
|
+
function createEvents() {
|
|
271
|
+
const custom = /* @__PURE__ */ new Map();
|
|
272
|
+
const listeners = /* @__PURE__ */ new Map();
|
|
273
|
+
let backHandler;
|
|
274
|
+
let eventBridge;
|
|
275
|
+
const owner = {};
|
|
276
|
+
const relayStops = /* @__PURE__ */ new Map();
|
|
277
|
+
function bridge() {
|
|
278
|
+
if (typeof window === "undefined") return void 0;
|
|
279
|
+
return window.dsBridge;
|
|
280
|
+
}
|
|
281
|
+
function ensureEventsRegistered() {
|
|
282
|
+
const current = bridge();
|
|
283
|
+
if (!current?.register || eventBridge === current) return;
|
|
284
|
+
relayStops.forEach((stop) => stop());
|
|
285
|
+
relayStops.clear();
|
|
286
|
+
if (eventBridge) getEventHub(eventBridge).setBack(owner);
|
|
287
|
+
const hub = getEventHub(current);
|
|
288
|
+
relayStops.set("dispatchEvent", hub.on("mwb.dispatchEvent", (message) => {
|
|
289
|
+
if (!message || typeof message !== "object") return;
|
|
290
|
+
const event = message;
|
|
291
|
+
if (!event.name) return;
|
|
292
|
+
for (const handler of [...listeners.get(event.name) ?? []]) {
|
|
293
|
+
try {
|
|
294
|
+
handler(event.data);
|
|
295
|
+
} catch (error) {
|
|
296
|
+
console.error("MWB event listener failed", error);
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
}));
|
|
300
|
+
eventBridge = current;
|
|
301
|
+
if (backHandler) hub.setBack(owner, backHandler);
|
|
302
|
+
for (const name of custom.keys()) attachCustom(name);
|
|
303
|
+
}
|
|
304
|
+
function attachCustom(name) {
|
|
305
|
+
if (!eventBridge || relayStops.has(`custom:${name}`)) return;
|
|
306
|
+
relayStops.set(`custom:${name}`, getEventHub(eventBridge).on(`mwb.${name}`, (data) => {
|
|
307
|
+
for (const callback of [...custom.get(name) ?? []]) {
|
|
308
|
+
try {
|
|
309
|
+
callback(data);
|
|
310
|
+
} catch (error) {
|
|
311
|
+
console.error("MWB handler failed", error);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
}));
|
|
315
|
+
}
|
|
316
|
+
function on(name, handler) {
|
|
317
|
+
ensureEventsRegistered();
|
|
318
|
+
if (!listeners.has(name)) listeners.set(name, /* @__PURE__ */ new Set());
|
|
319
|
+
listeners.get(name)?.add(handler);
|
|
320
|
+
}
|
|
321
|
+
function off(name, handler) {
|
|
322
|
+
listeners.get(name)?.delete(handler);
|
|
323
|
+
}
|
|
324
|
+
ensureEventsRegistered();
|
|
325
|
+
return {
|
|
326
|
+
registerHandler(handlerName, handler) {
|
|
327
|
+
ensureEventsRegistered();
|
|
328
|
+
if (!custom.has(handlerName)) {
|
|
329
|
+
custom.set(handlerName, /* @__PURE__ */ new Set());
|
|
330
|
+
}
|
|
331
|
+
custom.get(handlerName)?.add(handler);
|
|
332
|
+
attachCustom(handlerName);
|
|
333
|
+
},
|
|
334
|
+
unRegisterHandlers(handlerName) {
|
|
335
|
+
custom.delete(handlerName);
|
|
336
|
+
},
|
|
337
|
+
unRegisterHandler(handlerName, handler) {
|
|
338
|
+
const handlers = custom.get(handlerName);
|
|
339
|
+
handlers?.delete(handler);
|
|
340
|
+
if (handlers?.size === 0) custom.delete(handlerName);
|
|
341
|
+
},
|
|
342
|
+
checkHandlerExist(handlerName) {
|
|
343
|
+
return Boolean(custom.get(handlerName)?.size);
|
|
344
|
+
},
|
|
345
|
+
onNetworkStatusChange(handler) {
|
|
346
|
+
on("networkStatusChange", handler);
|
|
347
|
+
},
|
|
348
|
+
offNetworkStatusChange(handler) {
|
|
349
|
+
off("networkStatusChange", handler);
|
|
350
|
+
},
|
|
351
|
+
onAppShow(handler) {
|
|
352
|
+
on("appShow", handler);
|
|
353
|
+
},
|
|
354
|
+
offAppShow(handler) {
|
|
355
|
+
off("appShow", handler);
|
|
356
|
+
},
|
|
357
|
+
onAppHide(handler) {
|
|
358
|
+
on("appHide", handler);
|
|
359
|
+
},
|
|
360
|
+
offAppHide(handler) {
|
|
361
|
+
off("appHide", handler);
|
|
362
|
+
},
|
|
363
|
+
onRemoteNotificationReceive(handler) {
|
|
364
|
+
on("remoteNotificationReceive", handler);
|
|
365
|
+
},
|
|
366
|
+
offRemoteNotificationReceive(handler) {
|
|
367
|
+
off("remoteNotificationReceive", handler);
|
|
368
|
+
},
|
|
369
|
+
onPageShow(handler) {
|
|
370
|
+
on("pageShow", handler);
|
|
371
|
+
},
|
|
372
|
+
offPageShow(handler) {
|
|
373
|
+
off("pageShow", handler);
|
|
374
|
+
},
|
|
375
|
+
onPageHide(handler) {
|
|
376
|
+
on("pageHide", handler);
|
|
377
|
+
},
|
|
378
|
+
offPageHide(handler) {
|
|
379
|
+
off("pageHide", handler);
|
|
380
|
+
},
|
|
381
|
+
onBackBtnPressed(handler) {
|
|
382
|
+
ensureEventsRegistered();
|
|
383
|
+
backHandler = handler;
|
|
384
|
+
if (eventBridge) getEventHub(eventBridge).setBack(owner, handler);
|
|
385
|
+
},
|
|
386
|
+
offBackBtnPressed() {
|
|
387
|
+
backHandler = void 0;
|
|
388
|
+
if (eventBridge) getEventHub(eventBridge).setBack(owner);
|
|
389
|
+
}
|
|
390
|
+
};
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
// src/assembleMWB.ts
|
|
394
|
+
function assembleMWB(plugins) {
|
|
395
|
+
const events = createEvents();
|
|
396
|
+
const protectedNames = /* @__PURE__ */ new Set(["basic", "version", "hasPlugin", "pluginSession", "pluginInfo", "invokePlugin", "pluginEvent", "constructor", "prototype", "__proto__", ...Object.keys(events)]);
|
|
397
|
+
const methods = /* @__PURE__ */ Object.create(null);
|
|
398
|
+
const selected = /* @__PURE__ */ new Set();
|
|
399
|
+
for (const plugin of plugins) {
|
|
400
|
+
if (selected.has(plugin)) continue;
|
|
401
|
+
selected.add(plugin);
|
|
402
|
+
for (const [name, method] of Object.entries(plugin.methods)) {
|
|
403
|
+
if (protectedNames.has(name)) throw new Error(`Reserved MWB basic method: ${name}`);
|
|
404
|
+
if (Object.prototype.hasOwnProperty.call(methods, name)) throw new Error(`Duplicate MWB basic method: ${name}`);
|
|
405
|
+
methods[name] = method;
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
const nativeSetTheme = methods.setNavigationBarTheme;
|
|
409
|
+
if (nativeSetTheme) {
|
|
410
|
+
let currentActionClick;
|
|
411
|
+
methods.setNavigationBarTheme = async (param) => {
|
|
412
|
+
const { onActionClick, ...nativeParam } = param;
|
|
413
|
+
const result = await nativeSetTheme(nativeParam);
|
|
414
|
+
if (currentActionClick) events.unRegisterHandler("navigationActionClick", currentActionClick);
|
|
415
|
+
currentActionClick = void 0;
|
|
416
|
+
if (nativeParam.actionTxt?.trim() && onActionClick) {
|
|
417
|
+
events.registerHandler("navigationActionClick", onActionClick);
|
|
418
|
+
currentActionClick = onActionClick;
|
|
419
|
+
}
|
|
420
|
+
return result;
|
|
421
|
+
};
|
|
422
|
+
}
|
|
423
|
+
const basic = Object.freeze({ ...methods, ...events });
|
|
424
|
+
return { version, ...basic, basic };
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
// src/apiManifest.ts
|
|
428
|
+
var apiMethods = [
|
|
429
|
+
"notifyPageReady",
|
|
430
|
+
"setEnableDebug",
|
|
431
|
+
"openAppAuthorizeSetting",
|
|
432
|
+
"toast",
|
|
433
|
+
"getAppInfoSync",
|
|
434
|
+
"setBadgeCount",
|
|
435
|
+
"navigateTo",
|
|
436
|
+
"navigateBack",
|
|
437
|
+
"navigateBackToRoot",
|
|
438
|
+
"openExternalBrowser",
|
|
439
|
+
"setNavigationBarTheme",
|
|
440
|
+
"getDeviceInfoSync",
|
|
441
|
+
"getClipboardDataSync",
|
|
442
|
+
"setClipboardData",
|
|
443
|
+
"makePhoneCall",
|
|
444
|
+
"getNetworkTypeSync",
|
|
445
|
+
"getNotificationSwitchStatus",
|
|
446
|
+
"cleanWebviewCache",
|
|
447
|
+
"compressImage",
|
|
448
|
+
"scanCode",
|
|
449
|
+
"saveImageToPhotosAlbum",
|
|
450
|
+
"chooseImage",
|
|
451
|
+
"setStorageSync",
|
|
452
|
+
"getStorageSync",
|
|
453
|
+
"removeStorageSync",
|
|
454
|
+
"clearStorageSync",
|
|
455
|
+
"openFile",
|
|
456
|
+
"exitApp",
|
|
457
|
+
"checkRequestCameraPermissions",
|
|
458
|
+
"convertImagePathToBase64",
|
|
459
|
+
"openNativePage",
|
|
460
|
+
"registerHandler",
|
|
461
|
+
"unRegisterHandlers",
|
|
462
|
+
"unRegisterHandler",
|
|
463
|
+
"checkHandlerExist",
|
|
464
|
+
"onNetworkStatusChange",
|
|
465
|
+
"offNetworkStatusChange",
|
|
466
|
+
"onAppShow",
|
|
467
|
+
"offAppShow",
|
|
468
|
+
"onAppHide",
|
|
469
|
+
"offAppHide",
|
|
470
|
+
"onRemoteNotificationReceive",
|
|
471
|
+
"offRemoteNotificationReceive",
|
|
472
|
+
"onPageShow",
|
|
473
|
+
"offPageShow",
|
|
474
|
+
"onPageHide",
|
|
475
|
+
"offPageHide",
|
|
476
|
+
"onBackBtnPressed",
|
|
477
|
+
"offBackBtnPressed"
|
|
478
|
+
];
|
|
479
|
+
|
|
480
|
+
// src/bridge.ts
|
|
481
|
+
var MWBBridgeError = class extends Error {
|
|
482
|
+
constructor(errCode, errorMsg) {
|
|
483
|
+
super(errorMsg);
|
|
484
|
+
this.errCode = errCode;
|
|
485
|
+
this.errorMsg = errorMsg;
|
|
486
|
+
this.name = "MWBBridgeError";
|
|
487
|
+
}
|
|
488
|
+
};
|
|
489
|
+
function getBridge() {
|
|
490
|
+
if (typeof window === "undefined") {
|
|
491
|
+
throw new MWBBridgeError(-1e3, "MWB bridge is not ready");
|
|
492
|
+
}
|
|
493
|
+
const bridgeWindow = window;
|
|
494
|
+
const nativeReady = Boolean(bridgeWindow._dsbridge || bridgeWindow._dswk || typeof navigator !== "undefined" && navigator.userAgent.includes("_dsbridge"));
|
|
495
|
+
if (!nativeReady || !bridgeWindow.dsBridge) {
|
|
496
|
+
throw new MWBBridgeError(-1e3, "MWB bridge is not ready");
|
|
497
|
+
}
|
|
498
|
+
return bridgeWindow.dsBridge;
|
|
499
|
+
}
|
|
500
|
+
function parseNative(value) {
|
|
501
|
+
if (typeof value !== "string") return value;
|
|
502
|
+
try {
|
|
503
|
+
return JSON.parse(value);
|
|
504
|
+
} catch {
|
|
505
|
+
return value;
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
function callSync(method, args) {
|
|
509
|
+
const bridge = getBridge();
|
|
510
|
+
if (bridge.hasNativeMethod && !bridge.hasNativeMethod(`mwb.${method}`, "syn")) {
|
|
511
|
+
throw new MWBBridgeError(-1003, `MWB native method is unavailable: ${method}`);
|
|
512
|
+
}
|
|
513
|
+
try {
|
|
514
|
+
const value = parseNative(bridge.call(`mwb.${method}`, args));
|
|
515
|
+
if (value && typeof value === "object" && "errCode" in value && typeof value.errCode === "number" && value.errCode !== 0) {
|
|
516
|
+
throw new MWBBridgeError(
|
|
517
|
+
value.errCode,
|
|
518
|
+
"errorMsg" in value && typeof value.errorMsg === "string" ? value.errorMsg : `MWB call failed: ${method}`
|
|
519
|
+
);
|
|
520
|
+
}
|
|
521
|
+
return value;
|
|
522
|
+
} catch (error) {
|
|
523
|
+
if (error instanceof MWBBridgeError) throw error;
|
|
524
|
+
throw new MWBBridgeError(-1002, error instanceof Error ? error.message : String(error));
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
function callAsync(method, args) {
|
|
528
|
+
return new Promise((resolve, reject) => {
|
|
529
|
+
let bridge;
|
|
530
|
+
try {
|
|
531
|
+
bridge = getBridge();
|
|
532
|
+
if (bridge.hasNativeMethod && !bridge.hasNativeMethod(`mwb.${method}`, "asyn")) {
|
|
533
|
+
throw new MWBBridgeError(-1003, `MWB native method is unavailable: ${method}`);
|
|
534
|
+
}
|
|
535
|
+
bridge.call(`mwb.${method}`, args, (value) => {
|
|
536
|
+
const parsed = parseNative(value);
|
|
537
|
+
if (!parsed || typeof parsed !== "object" || typeof parsed.errCode !== "number") {
|
|
538
|
+
reject(new MWBBridgeError(-1001, `Invalid MWB native response: ${method}`));
|
|
539
|
+
return;
|
|
540
|
+
}
|
|
541
|
+
const result = parsed;
|
|
542
|
+
if (result.errCode === 0) resolve(result);
|
|
543
|
+
else reject(new MWBBridgeError(result.errCode, result.errorMsg ?? `MWB call failed: ${method}`));
|
|
544
|
+
});
|
|
545
|
+
} catch (error) {
|
|
546
|
+
reject(error instanceof MWBBridgeError ? error : new MWBBridgeError(-1002, error instanceof Error ? error.message : String(error)));
|
|
547
|
+
}
|
|
548
|
+
});
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
// src/nativePlugins.ts
|
|
552
|
+
var descriptorBrand = /* @__PURE__ */ Symbol("MWBNativePlugin");
|
|
553
|
+
var reserved = /* @__PURE__ */ new Set([...apiMethods, "basic", "version", "hasPlugin", "pluginSession", "pluginInfo", "invokePlugin", "pluginEvent", "dispatchEvent", "backBtnPressed", "on", "then", "catch", "finally", "toJSON", "inspect", "constructor", "prototype", "__proto__"]);
|
|
554
|
+
var methodReserved = /* @__PURE__ */ new Set(["on", "then", "catch", "finally", "toJSON", "inspect", "constructor", "prototype", "__proto__"]);
|
|
555
|
+
function validName(name) {
|
|
556
|
+
return typeof name === "string" && /^[a-z][a-zA-Z0-9_]*$/.test(name);
|
|
557
|
+
}
|
|
558
|
+
function defineNativePlugin() {
|
|
559
|
+
return (options) => {
|
|
560
|
+
if (!validName(options.name) || reserved.has(options.name)) throw new Error(`Invalid or reserved MWB plugin name: ${options.name}`);
|
|
561
|
+
const timeoutMs = options.timeoutMs ?? 3e4;
|
|
562
|
+
if (!Number.isInteger(timeoutMs) || timeoutMs < 1 || timeoutMs > 12e4) throw new Error("MWB timeoutMs must be an integer from 1 to 120000");
|
|
563
|
+
return Object.freeze({ name: options.name, timeoutMs, [descriptorBrand]: true });
|
|
564
|
+
};
|
|
565
|
+
}
|
|
566
|
+
function assertJSON(value, ancestors = /* @__PURE__ */ new Set()) {
|
|
567
|
+
if (value === null || typeof value === "string" || typeof value === "boolean") return;
|
|
568
|
+
if (typeof value === "number" && Number.isFinite(value)) return;
|
|
569
|
+
if (typeof value !== "object" || value === null || ancestors.has(value)) throw new MWBBridgeError(-1102, "Plugin data must be finite, acyclic JSON");
|
|
570
|
+
const prototype = Object.getPrototypeOf(value);
|
|
571
|
+
if (!Array.isArray(value) && prototype !== Object.prototype && prototype !== null) throw new MWBBridgeError(-1102, "Plugin data must contain plain JSON objects");
|
|
572
|
+
if (Object.getOwnPropertySymbols(value).length) throw new MWBBridgeError(-1102, "Symbol properties are not JSON data");
|
|
573
|
+
if (Object.values(Object.getOwnPropertyDescriptors(value)).some((property) => property.get || property.set)) {
|
|
574
|
+
throw new MWBBridgeError(-1102, "Plugin data must not contain accessors");
|
|
575
|
+
}
|
|
576
|
+
ancestors.add(value);
|
|
577
|
+
const values = Array.isArray(value) ? Array.from(value) : Object.values(value);
|
|
578
|
+
for (const child of values) assertJSON(child, ancestors);
|
|
579
|
+
ancestors.delete(value);
|
|
580
|
+
}
|
|
581
|
+
function envelope(value) {
|
|
582
|
+
if (typeof value === "string") {
|
|
583
|
+
try {
|
|
584
|
+
value = JSON.parse(value);
|
|
585
|
+
} catch {
|
|
586
|
+
throw new MWBBridgeError(-1102, "Invalid plugin response JSON");
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
if (!value || typeof value !== "object" || !("errCode" in value) || !Number.isInteger(value.errCode)) throw new MWBBridgeError(-1102, "Invalid plugin response");
|
|
590
|
+
const response = value;
|
|
591
|
+
if (response.errCode !== 0) throw new MWBBridgeError(response.errCode, response.errorMsg ?? "MWB plugin call failed");
|
|
592
|
+
if ("result" in response) assertJSON(response.result);
|
|
593
|
+
return response;
|
|
594
|
+
}
|
|
595
|
+
function session(bridge) {
|
|
596
|
+
if (bridge.hasNativeMethod && !bridge.hasNativeMethod("mwb.pluginSession", "syn")) throw new MWBBridgeError(-1106, "This app does not support MWB native plugins");
|
|
597
|
+
let value;
|
|
598
|
+
try {
|
|
599
|
+
value = bridge.call("mwb.pluginSession");
|
|
600
|
+
} catch (error) {
|
|
601
|
+
throw new MWBBridgeError(-1106, error instanceof Error ? error.message : "Plugin session unavailable");
|
|
602
|
+
}
|
|
603
|
+
if (value === void 0 || value === null || value === "") throw new MWBBridgeError(-1106, "This app does not support MWB native plugins");
|
|
604
|
+
const info = envelope(value).result;
|
|
605
|
+
if (info?.protocol !== 1 || typeof info.documentId !== "string" || !info.documentId) throw new MWBBridgeError(-1106, "Incompatible MWB plugin protocol");
|
|
606
|
+
return info;
|
|
607
|
+
}
|
|
608
|
+
var nextCall = 0;
|
|
609
|
+
function invoke(gateway, payload, timeoutMs) {
|
|
610
|
+
return new Promise((resolve, reject) => {
|
|
611
|
+
let timer;
|
|
612
|
+
let finished = false;
|
|
613
|
+
const complete = (value, error) => {
|
|
614
|
+
if (finished) return;
|
|
615
|
+
finished = true;
|
|
616
|
+
if (timer !== void 0) clearTimeout(timer);
|
|
617
|
+
try {
|
|
618
|
+
if (error) throw error;
|
|
619
|
+
resolve(envelope(value));
|
|
620
|
+
} catch (failure) {
|
|
621
|
+
reject(failure instanceof MWBBridgeError ? failure : new MWBBridgeError(-1105, failure instanceof Error ? failure.message : String(failure)));
|
|
622
|
+
}
|
|
623
|
+
};
|
|
624
|
+
try {
|
|
625
|
+
const bridge = getBridge();
|
|
626
|
+
const identity = session(bridge);
|
|
627
|
+
if (bridge.hasNativeMethod && !bridge.hasNativeMethod(gateway, "asyn")) throw new MWBBridgeError(-1106, "Plugin gateway unavailable in this app");
|
|
628
|
+
timer = setTimeout(() => complete(void 0, new MWBBridgeError(-1103, "MWB plugin call timed out")), timeoutMs);
|
|
629
|
+
bridge.call(gateway, { ...identity, ...payload }, (value) => complete(value));
|
|
630
|
+
} catch (error) {
|
|
631
|
+
complete(void 0, error);
|
|
632
|
+
}
|
|
633
|
+
});
|
|
634
|
+
}
|
|
635
|
+
async function hasNativePlugin(name) {
|
|
636
|
+
if (!validName(name)) throw new MWBBridgeError(-1102, "Invalid plugin name");
|
|
637
|
+
const value = await invoke("mwb.pluginInfo", { plugin: name }, 3e4);
|
|
638
|
+
if (typeof value.result?.available !== "boolean") throw new MWBBridgeError(-1102, "Invalid plugin availability response");
|
|
639
|
+
return value.result.available;
|
|
640
|
+
}
|
|
641
|
+
function notifyPageReady() {
|
|
642
|
+
return invoke("mwb.invokePlugin", {
|
|
643
|
+
plugin: "basic",
|
|
644
|
+
method: "notifyPageReady",
|
|
645
|
+
params: null,
|
|
646
|
+
callId: `mwb-${Date.now()}-${++nextCall}`,
|
|
647
|
+
timeoutMs: 3e4
|
|
648
|
+
}, 3e4);
|
|
649
|
+
}
|
|
650
|
+
function createNamespace(descriptor) {
|
|
651
|
+
const functions = /* @__PURE__ */ new Map();
|
|
652
|
+
const on = (name, handler) => {
|
|
653
|
+
if (!validName(name) || methodReserved.has(name) || typeof handler !== "function") throw new MWBBridgeError(-1102, "Invalid plugin event subscription");
|
|
654
|
+
const bridge = getBridge();
|
|
655
|
+
const identity = session(bridge);
|
|
656
|
+
return getEventHub(bridge).on("mwb.pluginEvent", (value) => {
|
|
657
|
+
if (!value || typeof value !== "object") return;
|
|
658
|
+
const event = value;
|
|
659
|
+
if (event.plugin === descriptor.name && event.name === name && event.documentId === identity.documentId) {
|
|
660
|
+
assertJSON(event.data);
|
|
661
|
+
handler(event.data);
|
|
662
|
+
}
|
|
663
|
+
});
|
|
664
|
+
};
|
|
665
|
+
return new Proxy(/* @__PURE__ */ Object.create(null), {
|
|
666
|
+
get(_target, property) {
|
|
667
|
+
if (property === "on") return on;
|
|
668
|
+
if (!validName(property) || methodReserved.has(property)) return void 0;
|
|
669
|
+
if (!functions.has(property)) functions.set(property, (...args) => {
|
|
670
|
+
try {
|
|
671
|
+
if (args.length > 1) throw new MWBBridgeError(-1102, "Plugin methods accept one JSON parameter");
|
|
672
|
+
const params = args[0] === void 0 ? null : args[0];
|
|
673
|
+
assertJSON(params);
|
|
674
|
+
return invoke("mwb.invokePlugin", {
|
|
675
|
+
plugin: descriptor.name,
|
|
676
|
+
method: property,
|
|
677
|
+
params,
|
|
678
|
+
callId: `mwb-${Date.now()}-${++nextCall}`,
|
|
679
|
+
timeoutMs: descriptor.timeoutMs
|
|
680
|
+
}, descriptor.timeoutMs);
|
|
681
|
+
} catch (error) {
|
|
682
|
+
return Promise.reject(error instanceof MWBBridgeError ? error : new MWBBridgeError(-1102, "Plugin parameters are not valid JSON"));
|
|
683
|
+
}
|
|
684
|
+
});
|
|
685
|
+
return functions.get(property);
|
|
686
|
+
}
|
|
687
|
+
});
|
|
688
|
+
}
|
|
689
|
+
function attachNativePlugins(target, plugins) {
|
|
690
|
+
for (const descriptor of plugins) {
|
|
691
|
+
if (descriptor[descriptorBrand] !== true || !validName(descriptor.name) || reserved.has(descriptor.name)) throw new Error("Invalid MWB native plugin descriptor");
|
|
692
|
+
if (Object.prototype.hasOwnProperty.call(target, descriptor.name)) throw new Error(`Duplicate MWB plugin: ${descriptor.name}`);
|
|
693
|
+
Object.defineProperty(target, descriptor.name, { value: createNamespace(descriptor), enumerable: true });
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
// src/plugins/container.ts
|
|
698
|
+
var containerPlugin = {
|
|
699
|
+
name: "container",
|
|
700
|
+
methods: {
|
|
701
|
+
notifyPageReady,
|
|
702
|
+
setEnableDebug(enabled) {
|
|
703
|
+
callSync("setEnableDebug", { enabled });
|
|
704
|
+
},
|
|
705
|
+
toast(param) {
|
|
706
|
+
return callAsync("toast", param);
|
|
707
|
+
},
|
|
708
|
+
navigateTo(param) {
|
|
709
|
+
return callAsync("navigateTo", param);
|
|
710
|
+
},
|
|
711
|
+
navigateBack(callbackInfo) {
|
|
712
|
+
return callAsync("navigateBack", callbackInfo);
|
|
713
|
+
},
|
|
714
|
+
navigateBackToRoot() {
|
|
715
|
+
return callAsync("navigateBackToRoot");
|
|
716
|
+
},
|
|
717
|
+
openExternalBrowser(param) {
|
|
718
|
+
return callAsync("openExternalBrowser", param);
|
|
719
|
+
},
|
|
720
|
+
setNavigationBarTheme(param) {
|
|
721
|
+
return callAsync("setNavigationBarTheme", param);
|
|
722
|
+
},
|
|
723
|
+
cleanWebviewCache() {
|
|
724
|
+
return callAsync("cleanWebviewCache");
|
|
725
|
+
},
|
|
726
|
+
exitApp() {
|
|
727
|
+
return callAsync("exitApp");
|
|
728
|
+
},
|
|
729
|
+
openNativePage(param) {
|
|
730
|
+
return callAsync("openNativePage", param);
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
};
|
|
734
|
+
|
|
735
|
+
// src/plugins/device.ts
|
|
736
|
+
var devicePlugin = {
|
|
737
|
+
name: "device",
|
|
738
|
+
methods: {
|
|
739
|
+
openAppAuthorizeSetting() {
|
|
740
|
+
return callAsync("openAppAuthorizeSetting");
|
|
741
|
+
},
|
|
742
|
+
getAppInfoSync() {
|
|
743
|
+
return callSync("getAppInfoSync");
|
|
744
|
+
},
|
|
745
|
+
setBadgeCount(param) {
|
|
746
|
+
return callAsync("setBadgeCount", param);
|
|
747
|
+
},
|
|
748
|
+
getDeviceInfoSync() {
|
|
749
|
+
return callSync("getDeviceInfoSync");
|
|
750
|
+
},
|
|
751
|
+
getClipboardDataSync() {
|
|
752
|
+
return callSync("getClipboardDataSync");
|
|
753
|
+
},
|
|
754
|
+
setClipboardData(param) {
|
|
755
|
+
return callAsync("setClipboardData", param);
|
|
756
|
+
},
|
|
757
|
+
makePhoneCall(param) {
|
|
758
|
+
return callAsync("makePhoneCall", param);
|
|
759
|
+
},
|
|
760
|
+
getNetworkTypeSync() {
|
|
761
|
+
return callSync("getNetworkTypeSync");
|
|
762
|
+
},
|
|
763
|
+
getNotificationSwitchStatus() {
|
|
764
|
+
return callAsync("getNotificationSwitchStatus");
|
|
765
|
+
}
|
|
766
|
+
}
|
|
767
|
+
};
|
|
768
|
+
|
|
769
|
+
// src/plugins/media.ts
|
|
770
|
+
var mediaPlugin = {
|
|
771
|
+
name: "media",
|
|
772
|
+
methods: {
|
|
773
|
+
compressImage(param) {
|
|
774
|
+
return callAsync("compressImage", param);
|
|
775
|
+
},
|
|
776
|
+
scanCode(param) {
|
|
777
|
+
return callAsync("scanCode", param);
|
|
778
|
+
},
|
|
779
|
+
saveImageToPhotosAlbum(param) {
|
|
780
|
+
return callAsync("saveImageToPhotosAlbum", param);
|
|
781
|
+
},
|
|
782
|
+
chooseImage(param) {
|
|
783
|
+
return callAsync("chooseImage", param);
|
|
784
|
+
},
|
|
785
|
+
openFile(param) {
|
|
786
|
+
return callAsync("openFile", param);
|
|
787
|
+
},
|
|
788
|
+
checkRequestCameraPermissions(param) {
|
|
789
|
+
return callAsync("checkRequestCameraPermissions", param);
|
|
790
|
+
},
|
|
791
|
+
convertImagePathToBase64(param) {
|
|
792
|
+
return callAsync("convertImagePathToBase64", param);
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
};
|
|
796
|
+
|
|
797
|
+
// src/plugins/storage.ts
|
|
798
|
+
var storagePlugin = {
|
|
799
|
+
name: "storage",
|
|
800
|
+
methods: {
|
|
801
|
+
setStorageSync(key, data, groupName, validSecond) {
|
|
802
|
+
callSync("setStorageSync", { key, data, groupName, validSecond });
|
|
803
|
+
},
|
|
804
|
+
getStorageSync(key, groupName) {
|
|
805
|
+
const response = callSync("getStorageSync", { key, groupName });
|
|
806
|
+
return response?.data;
|
|
807
|
+
},
|
|
808
|
+
removeStorageSync(key, groupName) {
|
|
809
|
+
callSync("removeStorageSync", { key, groupName });
|
|
810
|
+
},
|
|
811
|
+
clearStorageSync(groupName) {
|
|
812
|
+
callSync("clearStorageSync", { groupName });
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
};
|
|
816
|
+
|
|
817
|
+
// src/createMWB.ts
|
|
818
|
+
var defaultPlugins = [containerPlugin, devicePlugin, mediaPlugin, storagePlugin];
|
|
819
|
+
function createMWB(input = defaultPlugins) {
|
|
820
|
+
const sdk = assembleMWB(Array.isArray(input) ? input : defaultPlugins);
|
|
821
|
+
Object.assign(sdk, { hasPlugin: hasNativePlugin });
|
|
822
|
+
if (!Array.isArray(input)) attachNativePlugins(sdk, input.plugins);
|
|
823
|
+
return sdk;
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
// src/plugins/basic.ts
|
|
827
|
+
var basicPlugin = {
|
|
828
|
+
name: "basic",
|
|
829
|
+
methods: { ...containerPlugin.methods, ...devicePlugin.methods, ...mediaPlugin.methods, ...storagePlugin.methods }
|
|
830
|
+
};
|
|
831
|
+
|
|
832
|
+
// src/index.ts
|
|
833
|
+
var mwb = createMWB();
|
|
834
|
+
var index_default = mwb;
|
|
835
|
+
export {
|
|
836
|
+
MWBBridgeError,
|
|
837
|
+
basicPlugin,
|
|
838
|
+
containerPlugin,
|
|
839
|
+
createMWB,
|
|
840
|
+
index_default as default,
|
|
841
|
+
defineNativePlugin,
|
|
842
|
+
devicePlugin,
|
|
843
|
+
mediaPlugin,
|
|
844
|
+
mwb,
|
|
845
|
+
storagePlugin,
|
|
846
|
+
version
|
|
847
|
+
};
|