@ccos/ccsdk-lite 1.0.9 → 1.0.11
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/lib/app/index.d.ts +16 -26
- package/lib/audio/index.d.ts +0 -4
- package/lib/bundle.js +262 -292
- package/lib/core/index.d.ts +1 -1
- package/lib/index.d.ts +27 -32
- package/lib/network/index.d.ts +0 -8
- package/lib/pag/index.d.ts +19 -0
- package/lib/storage/index.d.ts +4 -4
- package/lib/system/index.d.ts +25 -12
- package/lib/tts/index.d.ts +17 -0
- package/lib/video/index.d.ts +0 -4
- package/package.json +1 -1
package/lib/bundle.js
CHANGED
|
@@ -85,7 +85,7 @@ function unsetAppCommandCallback() {
|
|
|
85
85
|
}
|
|
86
86
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
87
87
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
88
|
-
var
|
|
88
|
+
var persistentCallbackMap = new Map(); // 持久化 callback-id 与回调函数对应的列表 (回调函数可以多个,组成一个Set)
|
|
89
89
|
function nativeCall(funcName, callbackId, params) {
|
|
90
90
|
if (window['_liteNativeApi']) {
|
|
91
91
|
// 运行于 android 浏览器webview
|
|
@@ -97,6 +97,16 @@ function nativeCall(funcName, callbackId, params) {
|
|
|
97
97
|
};
|
|
98
98
|
window['_liteNativeApi'].exec(JSON.stringify(object1));
|
|
99
99
|
}
|
|
100
|
+
else if (window['CoocaaJsApiBridge']) { // 视九
|
|
101
|
+
// 运行于 android 浏览器webview
|
|
102
|
+
var object1 = {
|
|
103
|
+
func: funcName,
|
|
104
|
+
id: callbackId,
|
|
105
|
+
params: params || {},
|
|
106
|
+
apiCode: apiCode,
|
|
107
|
+
};
|
|
108
|
+
window['CoocaaJsApiBridge'].invoke(JSON.stringify(object1));
|
|
109
|
+
}
|
|
100
110
|
}
|
|
101
111
|
function nativeRequest(funcName, params, persistent, persistentIdName, persistentCallback) {
|
|
102
112
|
if (!persistent) {
|
|
@@ -108,12 +118,27 @@ function nativeRequest(funcName, params, persistent, persistentIdName, persisten
|
|
|
108
118
|
});
|
|
109
119
|
}
|
|
110
120
|
// 以下是持久化调用处理
|
|
111
|
-
var
|
|
112
|
-
if (
|
|
113
|
-
|
|
121
|
+
var id = persistentIdName;
|
|
122
|
+
if (!persistentCallbackMap.has(id)) {
|
|
123
|
+
persistentCallbackMap.set(id, new Set());
|
|
124
|
+
}
|
|
125
|
+
if (!persistentCallbackMap.get(id).has(persistentCallback)) {
|
|
126
|
+
persistentCallbackMap.get(id).add(persistentCallback);
|
|
114
127
|
}
|
|
115
|
-
|
|
116
|
-
|
|
128
|
+
// 构建一个回调函数
|
|
129
|
+
var myCallBack = function (payload) {
|
|
130
|
+
// 将 Set 转换为数组
|
|
131
|
+
var funcArray = Array.from(persistentCallbackMap.get(id));
|
|
132
|
+
// 使用 for 循环遍历数组
|
|
133
|
+
for (var i = 0; i < funcArray.length; i++) {
|
|
134
|
+
if (funcArray[i]) {
|
|
135
|
+
funcArray[i](payload);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
//
|
|
140
|
+
bus.remove(id);
|
|
141
|
+
bus.register(myCallBack, id); // 这里注册一个持久化的回调,通常应用于 native 会持续回调的情况
|
|
117
142
|
return new Promise(function (resolve) {
|
|
118
143
|
var callbackId = bus.register(function (res) {
|
|
119
144
|
resolve(res);
|
|
@@ -129,14 +154,23 @@ function callNative(funcName, params) {
|
|
|
129
154
|
function callWithPersistentCallBack(funcName, params, persistentIdName, callback) {
|
|
130
155
|
return nativeRequest(funcName, params, true, persistentIdName, callback);
|
|
131
156
|
}
|
|
132
|
-
// 注销一个持久的回调函数
|
|
133
|
-
function deletePersistentCallBack(persistentIdName) {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
return;
|
|
157
|
+
// 注销一个持久的回调函数 (对应id的所有回调函数都已经清空的话, 返回true, 如果该id如果还有其它回调函数, 返回false)
|
|
158
|
+
function deletePersistentCallBack(persistentIdName, callback) {
|
|
159
|
+
var id = persistentIdName;
|
|
160
|
+
if (!persistentCallbackMap.has(id)) {
|
|
161
|
+
bus.remove(id);
|
|
162
|
+
return true;
|
|
138
163
|
}
|
|
139
|
-
|
|
164
|
+
var ret = false;
|
|
165
|
+
if (persistentCallbackMap.get(id).has(callback)) {
|
|
166
|
+
persistentCallbackMap.get(id).delete(callback);
|
|
167
|
+
}
|
|
168
|
+
if (persistentCallbackMap.get(id).size == 0) {
|
|
169
|
+
ret = true;
|
|
170
|
+
persistentCallbackMap.delete(id);
|
|
171
|
+
bus.remove(id);
|
|
172
|
+
}
|
|
173
|
+
return ret;
|
|
140
174
|
}
|
|
141
175
|
function callbackFromNative(callbackId, data) {
|
|
142
176
|
var payload = '';
|
|
@@ -153,8 +187,7 @@ function callbackFromNative(callbackId, data) {
|
|
|
153
187
|
}
|
|
154
188
|
bus.fire(callbackId, payload);
|
|
155
189
|
// 判断,如果不是持久的回调函数,则调用完毕之后删除该回调
|
|
156
|
-
|
|
157
|
-
if (index < 0) {
|
|
190
|
+
if (!persistentCallbackMap.has(callbackId)) {
|
|
158
191
|
bus.remove(callbackId);
|
|
159
192
|
}
|
|
160
193
|
}
|
|
@@ -173,9 +206,9 @@ function initSDK() {
|
|
|
173
206
|
return callNative('tiny' + num4.toString(), null);
|
|
174
207
|
}
|
|
175
208
|
|
|
176
|
-
var moduleName$
|
|
177
|
-
function getFuncName$
|
|
178
|
-
return moduleName$
|
|
209
|
+
var moduleName$8 = 'network';
|
|
210
|
+
function getFuncName$8(name) {
|
|
211
|
+
return moduleName$8 + '_' + name;
|
|
179
212
|
}
|
|
180
213
|
function paramToUrl(params) {
|
|
181
214
|
if (!params)
|
|
@@ -207,7 +240,7 @@ function paramToUrl(params) {
|
|
|
207
240
|
}
|
|
208
241
|
// 简单的 HTTP 请求
|
|
209
242
|
function simpleHttpRequest(params) {
|
|
210
|
-
return callNative(getFuncName$
|
|
243
|
+
return callNative(getFuncName$8('simpleHttpRequest'), params);
|
|
211
244
|
}
|
|
212
245
|
function httpGet(url, urlParam, header, base64) {
|
|
213
246
|
var paramString = paramToUrl(urlParam);
|
|
@@ -306,19 +339,19 @@ function httpSseGet(url, urlParam, header, base64) {
|
|
|
306
339
|
}
|
|
307
340
|
// 获取网络的基本信息
|
|
308
341
|
function getNetworkInfo() {
|
|
309
|
-
return callNative(getFuncName$
|
|
342
|
+
return callNative(getFuncName$8('getNetworkInfo'), null);
|
|
310
343
|
}
|
|
311
344
|
// 获取合规化后的域名
|
|
312
345
|
function getDomainName(domain) {
|
|
313
|
-
return callNative(getFuncName$
|
|
346
|
+
return callNative(getFuncName$8('getDomainName'), { domain: domain });
|
|
314
347
|
}
|
|
315
348
|
// 获取基本 Header 信息
|
|
316
349
|
function getCommonHeader() {
|
|
317
|
-
return callNative(getFuncName$
|
|
350
|
+
return callNative(getFuncName$8('getCommonHeader'), null);
|
|
318
351
|
}
|
|
319
352
|
// 读取SSE流
|
|
320
353
|
function readSse(params) {
|
|
321
|
-
return callNative(getFuncName$
|
|
354
|
+
return callNative(getFuncName$8('readSse'), params);
|
|
322
355
|
}
|
|
323
356
|
// 下载一个文件到设备本地
|
|
324
357
|
// url : 需要下载的链接
|
|
@@ -335,7 +368,7 @@ function downloadToFile(url, tempFlag, method, header, postType, body) {
|
|
|
335
368
|
if (header === void 0) { header = ''; }
|
|
336
369
|
if (postType === void 0) { postType = ''; }
|
|
337
370
|
if (body === void 0) { body = ''; }
|
|
338
|
-
return callNative(getFuncName$
|
|
371
|
+
return callNative(getFuncName$8('downloadToFile'), {
|
|
339
372
|
url: url,
|
|
340
373
|
tempFlag: tempFlag,
|
|
341
374
|
method: method,
|
|
@@ -344,28 +377,6 @@ function downloadToFile(url, tempFlag, method, header, postType, body) {
|
|
|
344
377
|
body: body
|
|
345
378
|
});
|
|
346
379
|
}
|
|
347
|
-
var downloadListenerCallbackId = 'downloadListenerCallbackId';
|
|
348
|
-
// 设置下载的事件回调
|
|
349
|
-
// 注意: 使用此回调的话,不用时记得使用 deleteDownloadListener 注销事件回调
|
|
350
|
-
function setDownloadListener(callback) {
|
|
351
|
-
return callWithPersistentCallBack(getFuncName$7('setDownloadListener'), { callbackId: downloadListenerCallbackId }, downloadListenerCallbackId, callback);
|
|
352
|
-
}
|
|
353
|
-
// 注销下载的事件回调
|
|
354
|
-
function deleteDownloadListener() {
|
|
355
|
-
deletePersistentCallBack(downloadListenerCallbackId);
|
|
356
|
-
return callNative(getFuncName$7('deleteDownloadListener'), null);
|
|
357
|
-
}
|
|
358
|
-
var streamResponseListenerCallbackId = 'streamResponseListenerCallbackId';
|
|
359
|
-
// 设置SSE请求的事件回调
|
|
360
|
-
// 注意: 使用此回调的话,不用时记得使用 deleteStreamResponseListener 注销事件回调
|
|
361
|
-
function setStreamResponseListener(callback) {
|
|
362
|
-
return callWithPersistentCallBack(getFuncName$7('setStreamResponseListener'), { callbackId: streamResponseListenerCallbackId }, streamResponseListenerCallbackId, callback);
|
|
363
|
-
}
|
|
364
|
-
// 注销SSE请求的事件回调
|
|
365
|
-
function deleteStreamResponseListener() {
|
|
366
|
-
deletePersistentCallBack(streamResponseListenerCallbackId);
|
|
367
|
-
return callNative(getFuncName$7('deleteStreamResponseListener'), null);
|
|
368
|
-
}
|
|
369
380
|
var network = {
|
|
370
381
|
simpleHttpRequest: simpleHttpRequest,
|
|
371
382
|
httpGet: httpGet,
|
|
@@ -375,189 +386,148 @@ var network = {
|
|
|
375
386
|
getDomainName: getDomainName,
|
|
376
387
|
getCommonHeader: getCommonHeader,
|
|
377
388
|
downloadToFile: downloadToFile,
|
|
378
|
-
setDownloadListener: setDownloadListener,
|
|
379
|
-
deleteDownloadListener: deleteDownloadListener,
|
|
380
|
-
setStreamResponseListener: setStreamResponseListener,
|
|
381
|
-
deleteStreamResponseListener: deleteStreamResponseListener,
|
|
382
389
|
};
|
|
383
390
|
|
|
384
|
-
var moduleName$
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
var localBroadcastActionMap = new Map();
|
|
388
|
-
var globalBroadcastActionMap = new Map();
|
|
389
|
-
function getFuncName$6(name) {
|
|
390
|
-
return moduleName$6 + '_' + name;
|
|
391
|
-
}
|
|
392
|
-
function startActivity(params) {
|
|
393
|
-
return callNative(getFuncName$6('startActivity'), params);
|
|
394
|
-
}
|
|
395
|
-
function startService(params) {
|
|
396
|
-
return callNative(getFuncName$6('startService'), params);
|
|
397
|
-
}
|
|
398
|
-
function sendBroadcast(params) {
|
|
399
|
-
return callNative(getFuncName$6('sendBroadcast'), params);
|
|
400
|
-
}
|
|
401
|
-
function sendLocalBroadcast(params) {
|
|
402
|
-
return callNative(getFuncName$6('sendLocalBroadcast'), params);
|
|
403
|
-
}
|
|
404
|
-
function startBackEndAction(action) {
|
|
405
|
-
return callNative(getFuncName$6('startBackEndAction'), action);
|
|
406
|
-
}
|
|
407
|
-
function exitPage() {
|
|
408
|
-
callNative(getFuncName$6('exitPage'), null);
|
|
409
|
-
}
|
|
410
|
-
function moveTaskToBack() {
|
|
411
|
-
return callNative(getFuncName$6('moveTaskToBack'), null);
|
|
391
|
+
var moduleName$7 = 'app';
|
|
392
|
+
function getFuncName$7(name) {
|
|
393
|
+
return moduleName$7 + '_' + name;
|
|
412
394
|
}
|
|
413
395
|
function getUserInfo() {
|
|
414
|
-
return callNative(getFuncName$
|
|
396
|
+
return callNative(getFuncName$7('getUserInfo'), null);
|
|
415
397
|
}
|
|
416
|
-
function
|
|
417
|
-
return callNative(getFuncName$
|
|
398
|
+
function getHostAppInfo() {
|
|
399
|
+
return callNative(getFuncName$7('getHostAppInfo'), null);
|
|
418
400
|
}
|
|
419
|
-
function
|
|
420
|
-
return callNative(getFuncName$
|
|
401
|
+
function startPage(params) {
|
|
402
|
+
return callNative(getFuncName$7('startPage'), params);
|
|
421
403
|
}
|
|
422
|
-
function
|
|
423
|
-
|
|
424
|
-
var action = payload['action'];
|
|
425
|
-
if (localBroadcastActionMap.has(action)) {
|
|
426
|
-
var func = localBroadcastActionMap.get(action);
|
|
427
|
-
if (func) {
|
|
428
|
-
func(payload);
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
}
|
|
404
|
+
function startActivity(params) {
|
|
405
|
+
return callNative(getFuncName$7('startPage'), params);
|
|
432
406
|
}
|
|
433
|
-
function
|
|
434
|
-
|
|
435
|
-
var action = payload['action'];
|
|
436
|
-
if (globalBroadcastActionMap.has(action)) {
|
|
437
|
-
var func = globalBroadcastActionMap.get(action);
|
|
438
|
-
if (func) {
|
|
439
|
-
func(payload);
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
}
|
|
407
|
+
function exitPage() {
|
|
408
|
+
callNative(getFuncName$7('exitPage'), null);
|
|
443
409
|
}
|
|
444
|
-
function
|
|
445
|
-
|
|
446
|
-
//
|
|
447
|
-
return callWithPersistentCallBack(getFuncName$6('setLocalBroadcastHook'), { callbackId: localBroadcastHookCallbackId, action: action }, localBroadcastHookCallbackId, processLocalBroadcast);
|
|
410
|
+
function movePageToBack() {
|
|
411
|
+
return callNative(getFuncName$7('movePageToBack'), null);
|
|
448
412
|
}
|
|
449
|
-
function
|
|
450
|
-
|
|
451
|
-
return callNative(getFuncName$6('deleteLocalBroadcastHook'), { action: action });
|
|
413
|
+
function startService(params) {
|
|
414
|
+
return callNative(getFuncName$7('startService'), params);
|
|
452
415
|
}
|
|
453
|
-
function
|
|
454
|
-
|
|
455
|
-
//
|
|
456
|
-
return callWithPersistentCallBack(getFuncName$6('setBroadcastHook'), { callbackId: globalBroadcastHookCallbackId, action: action }, globalBroadcastHookCallbackId, processGlobalBroadcast);
|
|
416
|
+
function getInstalledAppInfo(params) {
|
|
417
|
+
return callNative(getFuncName$7('getInstalledAppInfo'), params);
|
|
457
418
|
}
|
|
458
|
-
function
|
|
459
|
-
|
|
460
|
-
return callNative(getFuncName$6('deleteBroadcastHook'), { action: action });
|
|
419
|
+
function getInstalledAppsList() {
|
|
420
|
+
callNative(getFuncName$7('getInstalledAppsList'), null);
|
|
461
421
|
}
|
|
462
|
-
function
|
|
463
|
-
|
|
464
|
-
if (params) {
|
|
465
|
-
if (typeof params == 'object') {
|
|
466
|
-
str = JSON.stringify(params);
|
|
467
|
-
}
|
|
468
|
-
else {
|
|
469
|
-
str = String(params);
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
return callNative(getFuncName$6('appPrivateMethod'), { method: method, params: str });
|
|
422
|
+
function execActionString(action) {
|
|
423
|
+
return callNative(getFuncName$7('execActionString'), action);
|
|
473
424
|
}
|
|
474
425
|
var app = {
|
|
426
|
+
getUserInfo: getUserInfo,
|
|
427
|
+
getHostAppInfo: getHostAppInfo,
|
|
428
|
+
startPage: startPage,
|
|
475
429
|
startActivity: startActivity,
|
|
476
|
-
startService: startService,
|
|
477
|
-
sendBroadcast: sendBroadcast,
|
|
478
|
-
sendLocalBroadcast: sendLocalBroadcast,
|
|
479
|
-
startBackEndAction: startBackEndAction,
|
|
480
430
|
exitPage: exitPage,
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
deleteLocalBroadcastHook: deleteLocalBroadcastHook,
|
|
487
|
-
setBroadcastHook: setBroadcastHook,
|
|
488
|
-
deleteBroadcastHook: deleteBroadcastHook,
|
|
489
|
-
appPrivateMethod: appPrivateMethod
|
|
431
|
+
movePageToBack: movePageToBack,
|
|
432
|
+
startService: startService,
|
|
433
|
+
getInstalledAppInfo: getInstalledAppInfo,
|
|
434
|
+
getInstalledAppsList: getInstalledAppsList,
|
|
435
|
+
execActionString: execActionString,
|
|
490
436
|
};
|
|
491
437
|
|
|
492
|
-
var moduleName$
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
return moduleName$5 + '_' + name;
|
|
496
|
-
}
|
|
497
|
-
// 获取SDK的版本信息
|
|
498
|
-
function getSdkVersion() {
|
|
499
|
-
return callNative(getFuncName$5('getSdkVersion'), null);
|
|
500
|
-
}
|
|
501
|
-
// 添加 Activity 的生命周期的回调钩子
|
|
502
|
-
function setLifeCycleHook(callback) {
|
|
503
|
-
return callWithPersistentCallBack(getFuncName$5('setLifeCycleHook'), { callbackId: lifeCycleHookCallbackId }, lifeCycleHookCallbackId, callback);
|
|
438
|
+
var moduleName$6 = 'system';
|
|
439
|
+
function getFuncName$6(name) {
|
|
440
|
+
return moduleName$6 + '_' + name;
|
|
504
441
|
}
|
|
505
|
-
//
|
|
506
|
-
function
|
|
507
|
-
|
|
508
|
-
return callNative(getFuncName$5('deleteLifeCycleHook'), null);
|
|
442
|
+
// 告知宿主,小程序或者网页已经准备好
|
|
443
|
+
function ready() {
|
|
444
|
+
return callNative(getFuncName$6('ready'), null);
|
|
509
445
|
}
|
|
510
|
-
//
|
|
511
|
-
function
|
|
512
|
-
return callNative(getFuncName$
|
|
446
|
+
// 获取启动参数
|
|
447
|
+
function getStartupParams() {
|
|
448
|
+
return callNative(getFuncName$6('getStartupParams'), null);
|
|
513
449
|
}
|
|
514
450
|
// 获取设备信息
|
|
515
451
|
function getDeviceInfo() {
|
|
516
|
-
return callNative(getFuncName$
|
|
452
|
+
return callNative(getFuncName$6('getDeviceInfo'), null);
|
|
453
|
+
}
|
|
454
|
+
// 获取显示屏幕信息
|
|
455
|
+
function getDisplayInfo() {
|
|
456
|
+
return callNative(getFuncName$6('getDisplayInfo'), null);
|
|
517
457
|
}
|
|
518
458
|
// 获取 android property 的值
|
|
519
459
|
function getProperty(key) {
|
|
520
|
-
return callNative(getFuncName$
|
|
521
|
-
}
|
|
522
|
-
// 获取当前设备所处的位置信息
|
|
523
|
-
function getLocation() {
|
|
524
|
-
return callNative(getFuncName$5('getLocation'), null);
|
|
460
|
+
return callNative(getFuncName$6('getProperty'), { propName: key });
|
|
525
461
|
}
|
|
526
462
|
// 检查 JS-API 是否已经实现
|
|
527
463
|
function checkApi(apiName) {
|
|
528
|
-
return callNative(getFuncName$
|
|
464
|
+
return callNative(getFuncName$6('checkApi'), { apiName: apiName });
|
|
465
|
+
}
|
|
466
|
+
// 获取本地字体的路径
|
|
467
|
+
function getFontPath(fontFileName) {
|
|
468
|
+
return callNative(getFuncName$6('getFontPath'), { fontFileName: fontFileName });
|
|
469
|
+
}
|
|
470
|
+
// 设置屏幕是否常亮
|
|
471
|
+
function setKeepScreenOn(enable) {
|
|
472
|
+
return callNative(getFuncName$6('setKeepScreenOn'), { enable: enable });
|
|
473
|
+
}
|
|
474
|
+
// 添加事件监听
|
|
475
|
+
function addEventListener(eventName, callback, options) {
|
|
476
|
+
if (options === void 0) { options = {}; }
|
|
477
|
+
return callWithPersistentCallBack(getFuncName$6('addEventListener'), { callbackId: eventName, options: options }, eventName, callback);
|
|
478
|
+
}
|
|
479
|
+
// 删除事件监听
|
|
480
|
+
function removeEventListener(eventName, callback, options) {
|
|
481
|
+
if (options === void 0) { options = {}; }
|
|
482
|
+
var ret = deletePersistentCallBack(eventName, callback);
|
|
483
|
+
if (ret) {
|
|
484
|
+
return callNative(getFuncName$6('removeEventListener'), { callbackId: eventName, options: options });
|
|
485
|
+
}
|
|
486
|
+
return new Promise(function (resolve) { resolve(); });
|
|
529
487
|
}
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
488
|
+
function sendBroadcast(params) {
|
|
489
|
+
return callNative(getFuncName$6('sendBroadcast'), params);
|
|
490
|
+
}
|
|
491
|
+
// 声明本页面接收并处理系统级的按键(如:返回、HOME、MENU 键)
|
|
492
|
+
function enableSystemKey(params) {
|
|
493
|
+
return callNative(getFuncName$6('enableSystemKey'), params);
|
|
533
494
|
}
|
|
534
495
|
var system = {
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
deleteLifeCycleHook: deleteLifeCycleHook,
|
|
538
|
-
enableSystemKey: enableSystemKey,
|
|
496
|
+
ready: ready,
|
|
497
|
+
getStartupParams: getStartupParams,
|
|
539
498
|
getDeviceInfo: getDeviceInfo,
|
|
499
|
+
getDisplayInfo: getDisplayInfo,
|
|
540
500
|
getProperty: getProperty,
|
|
541
|
-
getLocation: getLocation,
|
|
542
501
|
checkApi: checkApi,
|
|
543
|
-
|
|
502
|
+
getFontPath: getFontPath,
|
|
503
|
+
setKeepScreenOn: setKeepScreenOn,
|
|
504
|
+
addEventListener: addEventListener,
|
|
505
|
+
removeEventListener: removeEventListener,
|
|
506
|
+
sendBroadcast: sendBroadcast,
|
|
507
|
+
//registerKeysOrUnregisterKeys
|
|
508
|
+
//sendEvent
|
|
509
|
+
enableSystemKey: enableSystemKey,
|
|
544
510
|
};
|
|
545
511
|
|
|
546
|
-
var moduleName$
|
|
547
|
-
function getFuncName$
|
|
548
|
-
return moduleName$
|
|
512
|
+
var moduleName$5 = 'storage';
|
|
513
|
+
function getFuncName$5(name) {
|
|
514
|
+
return moduleName$5 + '_' + name;
|
|
549
515
|
}
|
|
550
|
-
function setKey(key, value) {
|
|
551
|
-
|
|
516
|
+
function setKey(key, value, namespace) {
|
|
517
|
+
if (namespace === void 0) { namespace = ''; }
|
|
518
|
+
return callNative(getFuncName$5('setKey'), { key: key, value: value, namespace: namespace });
|
|
552
519
|
}
|
|
553
|
-
function getKey(key) {
|
|
554
|
-
|
|
520
|
+
function getKey(key, namespace) {
|
|
521
|
+
if (namespace === void 0) { namespace = ''; }
|
|
522
|
+
return callNative(getFuncName$5('getKey'), { key: key, namespace: namespace });
|
|
555
523
|
}
|
|
556
|
-
function deleteKey(key) {
|
|
557
|
-
|
|
524
|
+
function deleteKey(key, namespace) {
|
|
525
|
+
if (namespace === void 0) { namespace = ''; }
|
|
526
|
+
return callNative(getFuncName$5('deleteKey'), { key: key, namespace: namespace });
|
|
558
527
|
}
|
|
559
|
-
function clearAllKeys() {
|
|
560
|
-
|
|
528
|
+
function clearAllKeys(namespace) {
|
|
529
|
+
if (namespace === void 0) { namespace = ''; }
|
|
530
|
+
return callNative(getFuncName$5('clearAllKeys'), { namespace: namespace });
|
|
561
531
|
}
|
|
562
532
|
var storage = {
|
|
563
533
|
setKey: setKey,
|
|
@@ -566,55 +536,54 @@ var storage = {
|
|
|
566
536
|
clearAllKeys: clearAllKeys
|
|
567
537
|
};
|
|
568
538
|
|
|
569
|
-
var moduleName$
|
|
570
|
-
function getFuncName$
|
|
571
|
-
return moduleName$
|
|
539
|
+
var moduleName$4 = 'audio';
|
|
540
|
+
function getFuncName$4(name) {
|
|
541
|
+
return moduleName$4 + '_' + name;
|
|
572
542
|
}
|
|
573
|
-
var audioPlayerListenerCallbackId = 'audioPlayerListenerCallbackId';
|
|
574
543
|
// 播放器,播放新的URL或者本地文件系统的路径
|
|
575
544
|
function playNew(path) {
|
|
576
|
-
return callNative(getFuncName$
|
|
545
|
+
return callNative(getFuncName$4('playNew'), { path: path });
|
|
577
546
|
}
|
|
578
547
|
// 播放器,停止播放
|
|
579
548
|
function stop$1() {
|
|
580
|
-
return callNative(getFuncName$
|
|
549
|
+
return callNative(getFuncName$4('stop'), null);
|
|
581
550
|
}
|
|
582
551
|
// 播放器,是否正在播放中
|
|
583
552
|
function isPlaying$1() {
|
|
584
|
-
return callNative(getFuncName$
|
|
553
|
+
return callNative(getFuncName$4('isPlaying'), null);
|
|
585
554
|
}
|
|
586
555
|
// 播放器,是否准备好
|
|
587
556
|
function hasPrepared$1() {
|
|
588
|
-
return callNative(getFuncName$
|
|
557
|
+
return callNative(getFuncName$4('hasPrepared'), null);
|
|
589
558
|
}
|
|
590
559
|
// 播放器,获取总时长
|
|
591
560
|
function getDuration$1() {
|
|
592
|
-
return callNative(getFuncName$
|
|
561
|
+
return callNative(getFuncName$4('getDuration'), null);
|
|
593
562
|
}
|
|
594
563
|
// 播放器,获取当前进度值
|
|
595
564
|
function getCurrentPosition$1() {
|
|
596
|
-
return callNative(getFuncName$
|
|
565
|
+
return callNative(getFuncName$4('getCurrentPosition'), null);
|
|
597
566
|
}
|
|
598
567
|
// 播放器,获取播放状态,返回的value为字符串来标识播放状态
|
|
599
568
|
// 例如:Idle, Initialized, Preparing, Prepared, Started, Paused, Stopped, Completed, Error, End
|
|
600
569
|
function getPlayerState$1() {
|
|
601
|
-
return callNative(getFuncName$
|
|
570
|
+
return callNative(getFuncName$4('getPlayerState'), null);
|
|
602
571
|
}
|
|
603
572
|
// 播放器,暂停播放
|
|
604
573
|
function pause$1() {
|
|
605
|
-
return callNative(getFuncName$
|
|
574
|
+
return callNative(getFuncName$4('pause'), null);
|
|
606
575
|
}
|
|
607
576
|
// 播放器,启动播放或者从暂停恢复播放
|
|
608
577
|
function start$1() {
|
|
609
|
-
return callNative(getFuncName$
|
|
578
|
+
return callNative(getFuncName$4('start'), null);
|
|
610
579
|
}
|
|
611
580
|
// 播放器,重新播放
|
|
612
581
|
function rePlay$1() {
|
|
613
|
-
return callNative(getFuncName$
|
|
582
|
+
return callNative(getFuncName$4('rePlay'), null);
|
|
614
583
|
}
|
|
615
584
|
// 播放器,seek
|
|
616
585
|
function seekTo$1(position) {
|
|
617
|
-
return callNative(getFuncName$
|
|
586
|
+
return callNative(getFuncName$4('seekTo'), { position: Math.floor(position) });
|
|
618
587
|
}
|
|
619
588
|
// 播放器,设置单片循环模式
|
|
620
589
|
// isLooping: 是否循环播放
|
|
@@ -622,26 +591,16 @@ function seekTo$1(position) {
|
|
|
622
591
|
// 会无感知重播,即重播时,不会调idle/ preparing/ prepared等开始播放之前的状态)
|
|
623
592
|
function setLooping$1(isLooping, silentLoop) {
|
|
624
593
|
if (silentLoop === void 0) { silentLoop = false; }
|
|
625
|
-
return callNative(getFuncName$
|
|
594
|
+
return callNative(getFuncName$4('setLooping'), { isLooping: isLooping, silentLoop: silentLoop });
|
|
626
595
|
}
|
|
627
596
|
// 设置音量
|
|
628
597
|
function setVolume(volume) {
|
|
629
|
-
return callNative(getFuncName$
|
|
598
|
+
return callNative(getFuncName$4('setVolume'), { volume: volume });
|
|
630
599
|
}
|
|
631
600
|
// 设置播放内核
|
|
632
601
|
// 值: DefaultPlayer, MediaPlayer, SocPlayer, ExoPlayer
|
|
633
602
|
function setPlayerCore$1(core) {
|
|
634
|
-
return callNative(getFuncName$
|
|
635
|
-
}
|
|
636
|
-
// 设置视频播放器的事件回调
|
|
637
|
-
// 注意: 使用此回调的话,不用时记得使用 deleteListener 注销事件回调
|
|
638
|
-
function setListener$1(callback) {
|
|
639
|
-
return callWithPersistentCallBack(getFuncName$3('setListener'), { callbackId: audioPlayerListenerCallbackId }, audioPlayerListenerCallbackId, callback);
|
|
640
|
-
}
|
|
641
|
-
// 注销视频播放器的事件回调
|
|
642
|
-
function deleteListener$1() {
|
|
643
|
-
deletePersistentCallBack(audioPlayerListenerCallbackId);
|
|
644
|
-
return callNative(getFuncName$3('deleteListener'), null);
|
|
603
|
+
return callNative(getFuncName$4('setPlayerCore'), { core: core });
|
|
645
604
|
}
|
|
646
605
|
var audio = {
|
|
647
606
|
playNew: playNew,
|
|
@@ -658,67 +617,64 @@ var audio = {
|
|
|
658
617
|
setLooping: setLooping$1,
|
|
659
618
|
setVolume: setVolume,
|
|
660
619
|
setPlayerCore: setPlayerCore$1,
|
|
661
|
-
setListener: setListener$1,
|
|
662
|
-
deleteListener: deleteListener$1
|
|
663
620
|
};
|
|
664
621
|
|
|
665
|
-
var moduleName$
|
|
666
|
-
function getFuncName$
|
|
667
|
-
return moduleName$
|
|
622
|
+
var moduleName$3 = 'video';
|
|
623
|
+
function getFuncName$3(name) {
|
|
624
|
+
return moduleName$3 + '_' + name;
|
|
668
625
|
}
|
|
669
|
-
var videoPlayerListenerCallbackId = 'videoPlayerListenerCallbackId';
|
|
670
626
|
// 设置视频播放窗口的位置与宽高
|
|
671
627
|
function setVideoLayout(width, height, x, y) {
|
|
672
|
-
return callNative(getFuncName$
|
|
628
|
+
return callNative(getFuncName$3('setVideoLayout'), { x: Number(x), y: Number(y), w: Number(width), h: Number(height) });
|
|
673
629
|
}
|
|
674
630
|
// 设置视频窗口是否显示
|
|
675
631
|
function setVideoVisible(show) {
|
|
676
|
-
return callNative(getFuncName$
|
|
632
|
+
return callNative(getFuncName$3('setVideoVisible'), { visible: show });
|
|
677
633
|
}
|
|
678
634
|
// 播放器,播放新的URL
|
|
679
635
|
function playNewUrl(url) {
|
|
680
|
-
return callNative(getFuncName$
|
|
636
|
+
return callNative(getFuncName$3('playNewUrl'), { url: url });
|
|
681
637
|
}
|
|
682
638
|
// 播放器,播放新的本地文件路径
|
|
683
639
|
function playNewFile(path) {
|
|
684
|
-
return callNative(getFuncName$
|
|
640
|
+
return callNative(getFuncName$3('playNewFile'), { path: path });
|
|
685
641
|
}
|
|
686
642
|
// 播放器,停止播放
|
|
687
643
|
function stop() {
|
|
688
|
-
return callNative(getFuncName$
|
|
644
|
+
return callNative(getFuncName$3('stop'), null);
|
|
689
645
|
}
|
|
690
646
|
// 播放器,暂停播放
|
|
691
647
|
function pause() {
|
|
692
|
-
return callNative(getFuncName$
|
|
648
|
+
return callNative(getFuncName$3('pause'), null);
|
|
693
649
|
}
|
|
694
650
|
// 播放器,启动播放或者从暂停恢复播放
|
|
695
651
|
function start() {
|
|
696
|
-
return callNative(getFuncName$
|
|
652
|
+
return callNative(getFuncName$3('start'), null);
|
|
697
653
|
}
|
|
698
654
|
// 播放器,seek
|
|
699
655
|
function seekTo(position) {
|
|
700
|
-
return callNative(getFuncName$
|
|
656
|
+
return callNative(getFuncName$3('seekTo'), { position: Math.floor(position) });
|
|
701
657
|
}
|
|
702
658
|
// 播放器,是否准备好
|
|
703
659
|
function hasPrepared() {
|
|
704
|
-
return callNative(getFuncName$
|
|
660
|
+
return callNative(getFuncName$3('hasPrepared'), null);
|
|
705
661
|
}
|
|
706
662
|
// 播放器,是否正在播放中
|
|
707
663
|
function isPlaying() {
|
|
708
|
-
return callNative(getFuncName$
|
|
664
|
+
return callNative(getFuncName$3('isPlaying'), null);
|
|
709
665
|
}
|
|
710
666
|
// 播放器,获取总时长
|
|
711
667
|
function getDuration() {
|
|
712
|
-
return callNative(getFuncName$
|
|
668
|
+
return callNative(getFuncName$3('getDuration'), null);
|
|
713
669
|
}
|
|
714
670
|
// 播放器,获取当前进度值
|
|
715
671
|
function getCurrentPosition() {
|
|
716
|
-
return callNative(getFuncName$
|
|
672
|
+
return callNative(getFuncName$3('getCurrentPosition'), null);
|
|
717
673
|
}
|
|
718
674
|
// 播放器,获取播放状态,返回的value为字符串来标识播放状态
|
|
719
675
|
// 例如:Idle, Initialized, Preparing, Prepared, Started, Paused, Stopped, Completed, Error, End
|
|
720
676
|
function getPlayerState() {
|
|
721
|
-
return callNative(getFuncName$
|
|
677
|
+
return callNative(getFuncName$3('getPlayerState'), null);
|
|
722
678
|
}
|
|
723
679
|
// 播放器,设置单片循环模式
|
|
724
680
|
// isLooping: 是否循环播放
|
|
@@ -726,50 +682,40 @@ function getPlayerState() {
|
|
|
726
682
|
// 会无感知重播,即重播时,不会调idle/ preparing/ prepared等开始播放之前的状态)
|
|
727
683
|
function setLooping(isLooping, silentLoop) {
|
|
728
684
|
if (silentLoop === void 0) { silentLoop = false; }
|
|
729
|
-
return callNative(getFuncName$
|
|
685
|
+
return callNative(getFuncName$3('setLooping'), { isLooping: isLooping, silentLoop: silentLoop });
|
|
730
686
|
}
|
|
731
687
|
// 播放器,设置自动屏保锁,即:开始或恢复播放->锁屏保,停止或暂停播放->释放屏保锁 默认关闭
|
|
732
688
|
function setAutoWakeLock(autoWakeLock) {
|
|
733
|
-
return callNative(getFuncName$
|
|
689
|
+
return callNative(getFuncName$3('setAutoWakeLock'), { autoWakeLock: autoWakeLock });
|
|
734
690
|
}
|
|
735
691
|
// 播放器,重新播放
|
|
736
692
|
function rePlay() {
|
|
737
|
-
return callNative(getFuncName$
|
|
693
|
+
return callNative(getFuncName$3('rePlay'), null);
|
|
738
694
|
}
|
|
739
695
|
// 播放器,设置是否自动播放,即 play ready 后音视频自动播放 默认开启
|
|
740
696
|
function setPlayWhenReady(playWhenReady) {
|
|
741
697
|
if (playWhenReady === void 0) { playWhenReady = true; }
|
|
742
|
-
return callNative(getFuncName$
|
|
698
|
+
return callNative(getFuncName$3('setPlayWhenReady'), { playWhenReady: playWhenReady });
|
|
743
699
|
}
|
|
744
700
|
// 获取当前设置的播放内核, 有可能会返回 DefaultPlayer
|
|
745
701
|
// 值: DefaultPlayer, MediaPlayer, SocPlayer, ExoPlayer
|
|
746
702
|
function getPlayerCore() {
|
|
747
|
-
return callNative(getFuncName$
|
|
703
|
+
return callNative(getFuncName$3('getPlayerCore'), null);
|
|
748
704
|
}
|
|
749
705
|
// 获取实际的播放内核, 部分内核如:最佳内核,实际上是在各个内核中进行选择,不会返回 DefaultPlayer
|
|
750
706
|
// 值: MediaPlayer, SocPlayer, ExoPlayer
|
|
751
707
|
function getRealPlayerCore() {
|
|
752
|
-
return callNative(getFuncName$
|
|
708
|
+
return callNative(getFuncName$3('getRealPlayerCore'), null);
|
|
753
709
|
}
|
|
754
710
|
// 设置播放内核
|
|
755
711
|
// 值: DefaultPlayer, MediaPlayer, SocPlayer, ExoPlayer
|
|
756
712
|
function setPlayerCore(core) {
|
|
757
|
-
return callNative(getFuncName$
|
|
713
|
+
return callNative(getFuncName$3('setPlayerCore'), { core: core });
|
|
758
714
|
}
|
|
759
715
|
// 设置渲染模式
|
|
760
716
|
// 值: SurfaceView, TextureView
|
|
761
717
|
function setRenderType(playerRender) {
|
|
762
|
-
return callNative(getFuncName$
|
|
763
|
-
}
|
|
764
|
-
// 设置视频播放器的事件回调
|
|
765
|
-
// 注意: 使用此回调的话,不用时记得使用 deleteListener 注销事件回调
|
|
766
|
-
function setListener(callback) {
|
|
767
|
-
return callWithPersistentCallBack(getFuncName$2('setListener'), { callbackId: videoPlayerListenerCallbackId }, videoPlayerListenerCallbackId, callback);
|
|
768
|
-
}
|
|
769
|
-
// 注销视频播放器的事件回调
|
|
770
|
-
function deleteListener() {
|
|
771
|
-
deletePersistentCallBack(videoPlayerListenerCallbackId);
|
|
772
|
-
return callNative(getFuncName$2('deleteListener'), null);
|
|
718
|
+
return callNative(getFuncName$3('setRenderType'), { playerRender: playerRender });
|
|
773
719
|
}
|
|
774
720
|
var video = {
|
|
775
721
|
setVideoLayout: setVideoLayout,
|
|
@@ -793,13 +739,11 @@ var video = {
|
|
|
793
739
|
getRealPlayerCore: getRealPlayerCore,
|
|
794
740
|
setPlayerCore: setPlayerCore,
|
|
795
741
|
setRenderType: setRenderType,
|
|
796
|
-
setListener: setListener,
|
|
797
|
-
deleteListener: deleteListener,
|
|
798
742
|
};
|
|
799
743
|
|
|
800
|
-
var moduleName$
|
|
801
|
-
function getFuncName$
|
|
802
|
-
return moduleName$
|
|
744
|
+
var moduleName$2 = 'fs';
|
|
745
|
+
function getFuncName$2(name) {
|
|
746
|
+
return moduleName$2 + '_' + name;
|
|
803
747
|
}
|
|
804
748
|
// 读取文件并返回文件的所有内容
|
|
805
749
|
// 参数:
|
|
@@ -807,7 +751,7 @@ function getFuncName$1(name) {
|
|
|
807
751
|
// base64Flag: 是否以base64编码方式返回, 如果读取文本文件,则应该设置 base64Flag = false,如果读取二进制文件,则应该设置 base64Flag = true
|
|
808
752
|
function readAllContent(path, base64Flag) {
|
|
809
753
|
if (base64Flag === void 0) { base64Flag = false; }
|
|
810
|
-
return callNative(getFuncName$
|
|
754
|
+
return callNative(getFuncName$2('readAllContent'), { path: path, base64Flag: base64Flag });
|
|
811
755
|
}
|
|
812
756
|
// 将内容全部写入文件
|
|
813
757
|
// 参数:
|
|
@@ -816,114 +760,114 @@ function readAllContent(path, base64Flag) {
|
|
|
816
760
|
// base64Flag: 是否以base64编码方式传输content, 如果写文本文件,则应该设置 base64Flag = false,如果写入二进制文件,则应该设置 base64Flag = true
|
|
817
761
|
function writeAllContent(path, content, base64Flag) {
|
|
818
762
|
if (base64Flag === void 0) { base64Flag = false; }
|
|
819
|
-
return callNative(getFuncName$
|
|
763
|
+
return callNative(getFuncName$2('writeAllContent'), { path: path, content: content, base64Flag: base64Flag });
|
|
820
764
|
}
|
|
821
765
|
// 获取应用基本目录的全路径名
|
|
822
766
|
function getAppBaseDir() {
|
|
823
|
-
return callNative(getFuncName$
|
|
767
|
+
return callNative(getFuncName$2('getAppBaseDir'), null);
|
|
824
768
|
}
|
|
825
769
|
// 获取 Cache 目录的全路径名
|
|
826
770
|
function getAppCacheDir() {
|
|
827
|
-
return callNative(getFuncName$
|
|
771
|
+
return callNative(getFuncName$2('getAppCacheDir'), null);
|
|
828
772
|
}
|
|
829
773
|
// 构建一个临时文件名,返回该文件的绝对路径的全文件路径名
|
|
830
774
|
// 参数:
|
|
831
775
|
// fileName: 指定临时文件的基本名,如果不指定,会默认随机生成一个文件名
|
|
832
776
|
function makeCacheFile(fileName) {
|
|
833
777
|
if (fileName === void 0) { fileName = ''; }
|
|
834
|
-
return callNative(getFuncName$
|
|
778
|
+
return callNative(getFuncName$2('makeCacheFile'), { fileName: fileName });
|
|
835
779
|
}
|
|
836
780
|
// 构建一个正常文件名,返回该文件的绝对路径的全文件路径名
|
|
837
781
|
// 参数:
|
|
838
782
|
// fileName: 指定文件的基本名,如果不指定,会默认随机生成一个文件名
|
|
839
783
|
function makeNormalFile(fileName) {
|
|
840
784
|
if (fileName === void 0) { fileName = ''; }
|
|
841
|
-
return callNative(getFuncName$
|
|
785
|
+
return callNative(getFuncName$2('makeNormalFile'), { fileName: fileName });
|
|
842
786
|
}
|
|
843
787
|
// 检测一个文件或者目录是否存在
|
|
844
788
|
// 参数:
|
|
845
789
|
// path: 指定路径
|
|
846
790
|
function exists(path) {
|
|
847
|
-
return callNative(getFuncName$
|
|
791
|
+
return callNative(getFuncName$2('exists'), { path: path });
|
|
848
792
|
}
|
|
849
793
|
// 检测一个路径是否为一个普通文件
|
|
850
794
|
// 参数:
|
|
851
795
|
// path: 指定路径
|
|
852
796
|
function isFile(path) {
|
|
853
|
-
return callNative(getFuncName$
|
|
797
|
+
return callNative(getFuncName$2('isFile'), { path: path });
|
|
854
798
|
}
|
|
855
799
|
// 检测一个路径是否为一个目录
|
|
856
800
|
// 参数:
|
|
857
801
|
// path: 指定路径
|
|
858
802
|
function isDirectory(path) {
|
|
859
|
-
return callNative(getFuncName$
|
|
803
|
+
return callNative(getFuncName$2('isDirectory'), { path: path });
|
|
860
804
|
}
|
|
861
805
|
// 检测一个路径表示的文件或目录 是否是隐藏的
|
|
862
806
|
// 参数:
|
|
863
807
|
// path: 指定路径
|
|
864
808
|
function isHidden(path) {
|
|
865
|
-
return callNative(getFuncName$
|
|
809
|
+
return callNative(getFuncName$2('isHidden'), { path: path });
|
|
866
810
|
}
|
|
867
811
|
// 检测一个路径表示的文件或目录 是否可读
|
|
868
812
|
// 参数:
|
|
869
813
|
// path: 指定路径
|
|
870
814
|
function canRead(path) {
|
|
871
|
-
return callNative(getFuncName$
|
|
815
|
+
return callNative(getFuncName$2('canRead'), { path: path });
|
|
872
816
|
}
|
|
873
817
|
// 检测一个路径表示的文件或目录 是否可写
|
|
874
818
|
// 参数:
|
|
875
819
|
// path: 指定路径
|
|
876
820
|
function canWrite(path) {
|
|
877
|
-
return callNative(getFuncName$
|
|
821
|
+
return callNative(getFuncName$2('canWrite'), { path: path });
|
|
878
822
|
}
|
|
879
823
|
// 检测一个路径表示的文件或目录 是否可执行
|
|
880
824
|
// 参数:
|
|
881
825
|
// path: 指定路径
|
|
882
826
|
function canExecute(path) {
|
|
883
|
-
return callNative(getFuncName$
|
|
827
|
+
return callNative(getFuncName$2('canExecute'), { path: path });
|
|
884
828
|
}
|
|
885
829
|
// 检测一个路径表示的文件或目录 的最后修改的时间,返回时间戳(1970年开始的秒数)
|
|
886
830
|
// 参数:
|
|
887
831
|
// path: 指定路径
|
|
888
832
|
function lastModified(path) {
|
|
889
|
-
return callNative(getFuncName$
|
|
833
|
+
return callNative(getFuncName$2('lastModified'), { path: path });
|
|
890
834
|
}
|
|
891
835
|
// 删除文件
|
|
892
836
|
// 参数:
|
|
893
837
|
// path: 指定路径
|
|
894
838
|
function deleteIt(path) {
|
|
895
|
-
return callNative(getFuncName$
|
|
839
|
+
return callNative(getFuncName$2('delete'), { path: path });
|
|
896
840
|
}
|
|
897
841
|
// 新建目录
|
|
898
842
|
// 参数:
|
|
899
843
|
// path: 指定路径
|
|
900
844
|
function mkdir(path) {
|
|
901
|
-
return callNative(getFuncName$
|
|
845
|
+
return callNative(getFuncName$2('mkdir'), { path: path });
|
|
902
846
|
}
|
|
903
847
|
// 新建目录 (如果父目录补存在则一并新建所有尚未存在的父目录)
|
|
904
848
|
// 参数:
|
|
905
849
|
// path: 指定路径
|
|
906
850
|
function mkdirs(path) {
|
|
907
|
-
return callNative(getFuncName$
|
|
851
|
+
return callNative(getFuncName$2('mkdirs'), { path: path });
|
|
908
852
|
}
|
|
909
853
|
// 改名
|
|
910
854
|
// 参数:
|
|
911
855
|
// from: 指定源路径
|
|
912
856
|
// to: 指定目标路径
|
|
913
857
|
function rename(from, to) {
|
|
914
|
-
return callNative(getFuncName$
|
|
858
|
+
return callNative(getFuncName$2('rename'), { from: from, to: to });
|
|
915
859
|
}
|
|
916
860
|
// 将相对路径的转换为全路径
|
|
917
861
|
// 参数:
|
|
918
862
|
// path: 指定路径
|
|
919
863
|
function getAbsolutePath(path) {
|
|
920
|
-
return callNative(getFuncName$
|
|
864
|
+
return callNative(getFuncName$2('getAbsolutePath'), { path: path });
|
|
921
865
|
}
|
|
922
866
|
// 指定路径创建新文件
|
|
923
867
|
// 参数:
|
|
924
868
|
// path: 指定路径
|
|
925
869
|
function createNewFile(path) {
|
|
926
|
-
return callNative(getFuncName$
|
|
870
|
+
return callNative(getFuncName$2('createNewFile'), { path: path });
|
|
927
871
|
}
|
|
928
872
|
// 设置可读属性
|
|
929
873
|
// 参数:
|
|
@@ -931,7 +875,7 @@ function createNewFile(path) {
|
|
|
931
875
|
// value: 是否可读
|
|
932
876
|
function setReadable(path, value) {
|
|
933
877
|
if (value === void 0) { value = true; }
|
|
934
|
-
return callNative(getFuncName$
|
|
878
|
+
return callNative(getFuncName$2('setReadable'), { path: path, value: value });
|
|
935
879
|
}
|
|
936
880
|
// 设置可写属性
|
|
937
881
|
// 参数:
|
|
@@ -939,7 +883,7 @@ function setReadable(path, value) {
|
|
|
939
883
|
// value: 是否可写
|
|
940
884
|
function setWritable(path, value) {
|
|
941
885
|
if (value === void 0) { value = true; }
|
|
942
|
-
return callNative(getFuncName$
|
|
886
|
+
return callNative(getFuncName$2('setWritable'), { path: path, value: value });
|
|
943
887
|
}
|
|
944
888
|
// 设置可执行属性
|
|
945
889
|
// 参数:
|
|
@@ -947,7 +891,7 @@ function setWritable(path, value) {
|
|
|
947
891
|
// value: 是否可执行
|
|
948
892
|
function setExecutable(path, value) {
|
|
949
893
|
if (value === void 0) { value = true; }
|
|
950
|
-
return callNative(getFuncName$
|
|
894
|
+
return callNative(getFuncName$2('setExecutable'), { path: path, value: value });
|
|
951
895
|
}
|
|
952
896
|
// 设置文件最后修改的时间
|
|
953
897
|
// 参数:
|
|
@@ -955,13 +899,13 @@ function setExecutable(path, value) {
|
|
|
955
899
|
// value: 时间戳
|
|
956
900
|
function setLastModified(path, value) {
|
|
957
901
|
if (value === void 0) { value = 0; }
|
|
958
|
-
return callNative(getFuncName$
|
|
902
|
+
return callNative(getFuncName$2('setLastModified'), { path: path, value: value });
|
|
959
903
|
}
|
|
960
904
|
// 读取目录,返回该目录下的文件列表
|
|
961
905
|
// 参数:
|
|
962
906
|
// path: 指定路径
|
|
963
907
|
function list(path) {
|
|
964
|
-
return callNative(getFuncName$
|
|
908
|
+
return callNative(getFuncName$2('list'), { path: path });
|
|
965
909
|
}
|
|
966
910
|
var fs = {
|
|
967
911
|
readAllContent: readAllContent,
|
|
@@ -991,19 +935,19 @@ var fs = {
|
|
|
991
935
|
list: list
|
|
992
936
|
};
|
|
993
937
|
|
|
994
|
-
var moduleName = '
|
|
995
|
-
function getFuncName(name) {
|
|
996
|
-
return moduleName + '_' + name;
|
|
938
|
+
var moduleName$1 = 'pag';
|
|
939
|
+
function getFuncName$1(name) {
|
|
940
|
+
return moduleName$1 + '_' + name;
|
|
997
941
|
}
|
|
998
942
|
// 播放PAG动画
|
|
999
943
|
// repeat: 循环次数 -1 表示无限
|
|
1000
944
|
//
|
|
1001
945
|
function startNewPagAni(params) {
|
|
1002
|
-
return callNative(getFuncName('startNewPagAni'), params);
|
|
946
|
+
return callNative(getFuncName$1('startNewPagAni'), params);
|
|
1003
947
|
}
|
|
1004
948
|
// 停止PAG动画,并消失
|
|
1005
949
|
function stopPagAni() {
|
|
1006
|
-
return callNative(getFuncName('stopPagAni'), null);
|
|
950
|
+
return callNative(getFuncName$1('stopPagAni'), null);
|
|
1007
951
|
}
|
|
1008
952
|
function setPagVisibility(visible) {
|
|
1009
953
|
if (visible === void 0) { visible = true; }
|
|
@@ -1020,10 +964,10 @@ function setPagVisibility(visible) {
|
|
|
1020
964
|
else {
|
|
1021
965
|
value = visible;
|
|
1022
966
|
}
|
|
1023
|
-
return callNative(getFuncName('setPagVisibility'), { visible: value });
|
|
967
|
+
return callNative(getFuncName$1('setPagVisibility'), { visible: value });
|
|
1024
968
|
}
|
|
1025
969
|
function setPagXY(x, y) {
|
|
1026
|
-
return callNative(getFuncName('setPagXY'), { x: x, y: y });
|
|
970
|
+
return callNative(getFuncName$1('setPagXY'), { x: x, y: y });
|
|
1027
971
|
}
|
|
1028
972
|
// // 播报 TTS 文本语音
|
|
1029
973
|
// export function sendTts(text: string, ttsId: string): Promise<any> {
|
|
@@ -1054,7 +998,7 @@ function setPagXY(x, y) {
|
|
|
1054
998
|
// export function clearBackground() : Promise<any> {
|
|
1055
999
|
// return callNative(getFuncName('clearBackground'), null);
|
|
1056
1000
|
// }
|
|
1057
|
-
var
|
|
1001
|
+
var pag = {
|
|
1058
1002
|
startNewPagAni: startNewPagAni,
|
|
1059
1003
|
stopPagAni: stopPagAni,
|
|
1060
1004
|
setPagVisibility: setPagVisibility,
|
|
@@ -1066,6 +1010,29 @@ var nativeView = {
|
|
|
1066
1010
|
// clearBackground,
|
|
1067
1011
|
};
|
|
1068
1012
|
|
|
1013
|
+
var moduleName = 'tts';
|
|
1014
|
+
function getFuncName(name) {
|
|
1015
|
+
return moduleName + '_' + name;
|
|
1016
|
+
}
|
|
1017
|
+
// 停止TTS播报
|
|
1018
|
+
//
|
|
1019
|
+
function stopTts() {
|
|
1020
|
+
return callNative(getFuncName('stopTts'), {});
|
|
1021
|
+
}
|
|
1022
|
+
// 开始 TTS 播报
|
|
1023
|
+
function sendTts(text, ttsId) {
|
|
1024
|
+
return callNative(getFuncName('sendTts'), { text: text, ttsId: ttsId });
|
|
1025
|
+
}
|
|
1026
|
+
// 流式播报 TTS
|
|
1027
|
+
function sendStreamTts(text, ttsId, isFirst, isEnd) {
|
|
1028
|
+
return callNative(getFuncName('sendStreamTts'), { text: text, ttsId: ttsId, isFirst: isFirst, isEnd: isEnd });
|
|
1029
|
+
}
|
|
1030
|
+
var tts = {
|
|
1031
|
+
stopTts: stopTts,
|
|
1032
|
+
sendTts: sendTts,
|
|
1033
|
+
sendStreamTts: sendStreamTts,
|
|
1034
|
+
};
|
|
1035
|
+
|
|
1069
1036
|
function apkNativeCallJs(str) {
|
|
1070
1037
|
var res = null;
|
|
1071
1038
|
//console.log('str1=' + str);
|
|
@@ -1099,7 +1066,9 @@ function isRunInAppBrowser() {
|
|
|
1099
1066
|
return window['_liteNativeApi'] ? true : false;
|
|
1100
1067
|
}
|
|
1101
1068
|
function init() {
|
|
1102
|
-
window['
|
|
1069
|
+
if (window['_liteNativeApi']) {
|
|
1070
|
+
window['appNativeCall'] = apkNativeCallJs;
|
|
1071
|
+
}
|
|
1103
1072
|
initSDK();
|
|
1104
1073
|
}
|
|
1105
1074
|
var index = {
|
|
@@ -1110,7 +1079,8 @@ var index = {
|
|
|
1110
1079
|
storage: storage,
|
|
1111
1080
|
audio: audio,
|
|
1112
1081
|
video: video,
|
|
1113
|
-
|
|
1082
|
+
pag: pag,
|
|
1083
|
+
tts: tts,
|
|
1114
1084
|
fs: fs,
|
|
1115
1085
|
isRunInAppBrowser: isRunInAppBrowser
|
|
1116
1086
|
};
|