@ccos/ccsdk-lite 1.0.11 → 1.0.13

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/bundle.js CHANGED
@@ -206,9 +206,9 @@ function initSDK() {
206
206
  return callNative('tiny' + num4.toString(), null);
207
207
  }
208
208
 
209
- var moduleName$8 = 'network';
210
- function getFuncName$8(name) {
211
- return moduleName$8 + '_' + name;
209
+ var moduleName$9 = 'network';
210
+ function getFuncName$9(name) {
211
+ return moduleName$9 + '_' + name;
212
212
  }
213
213
  function paramToUrl(params) {
214
214
  if (!params)
@@ -240,7 +240,7 @@ function paramToUrl(params) {
240
240
  }
241
241
  // 简单的 HTTP 请求
242
242
  function simpleHttpRequest(params) {
243
- return callNative(getFuncName$8('simpleHttpRequest'), params);
243
+ return callNative(getFuncName$9('simpleHttpRequest'), params);
244
244
  }
245
245
  function httpGet(url, urlParam, header, base64) {
246
246
  var paramString = paramToUrl(urlParam);
@@ -339,19 +339,19 @@ function httpSseGet(url, urlParam, header, base64) {
339
339
  }
340
340
  // 获取网络的基本信息
341
341
  function getNetworkInfo() {
342
- return callNative(getFuncName$8('getNetworkInfo'), null);
342
+ return callNative(getFuncName$9('getNetworkInfo'), null);
343
343
  }
344
344
  // 获取合规化后的域名
345
345
  function getDomainName(domain) {
346
- return callNative(getFuncName$8('getDomainName'), { domain: domain });
346
+ return callNative(getFuncName$9('getDomainName'), { domain: domain });
347
347
  }
348
348
  // 获取基本 Header 信息
349
349
  function getCommonHeader() {
350
- return callNative(getFuncName$8('getCommonHeader'), null);
350
+ return callNative(getFuncName$9('getCommonHeader'), null);
351
351
  }
352
352
  // 读取SSE流
353
353
  function readSse(params) {
354
- return callNative(getFuncName$8('readSse'), params);
354
+ return callNative(getFuncName$9('readSse'), params);
355
355
  }
356
356
  // 下载一个文件到设备本地
357
357
  // url : 需要下载的链接
@@ -368,7 +368,7 @@ function downloadToFile(url, tempFlag, method, header, postType, body) {
368
368
  if (header === void 0) { header = ''; }
369
369
  if (postType === void 0) { postType = ''; }
370
370
  if (body === void 0) { body = ''; }
371
- return callNative(getFuncName$8('downloadToFile'), {
371
+ return callNative(getFuncName$9('downloadToFile'), {
372
372
  url: url,
373
373
  tempFlag: tempFlag,
374
374
  method: method,
@@ -388,39 +388,39 @@ var network = {
388
388
  downloadToFile: downloadToFile,
389
389
  };
390
390
 
391
- var moduleName$7 = 'app';
392
- function getFuncName$7(name) {
393
- return moduleName$7 + '_' + name;
391
+ var moduleName$8 = 'app';
392
+ function getFuncName$8(name) {
393
+ return moduleName$8 + '_' + name;
394
394
  }
395
395
  function getUserInfo() {
396
- return callNative(getFuncName$7('getUserInfo'), null);
396
+ return callNative(getFuncName$8('getUserInfo'), null);
397
397
  }
398
398
  function getHostAppInfo() {
399
- return callNative(getFuncName$7('getHostAppInfo'), null);
399
+ return callNative(getFuncName$8('getHostAppInfo'), null);
400
400
  }
401
401
  function startPage(params) {
402
- return callNative(getFuncName$7('startPage'), params);
402
+ return callNative(getFuncName$8('startPage'), params);
403
403
  }
404
404
  function startActivity(params) {
405
- return callNative(getFuncName$7('startPage'), params);
405
+ return callNative(getFuncName$8('startPage'), params);
406
406
  }
407
407
  function exitPage() {
408
- callNative(getFuncName$7('exitPage'), null);
408
+ callNative(getFuncName$8('exitPage'), null);
409
409
  }
410
410
  function movePageToBack() {
411
- return callNative(getFuncName$7('movePageToBack'), null);
411
+ return callNative(getFuncName$8('movePageToBack'), null);
412
412
  }
413
413
  function startService(params) {
414
- return callNative(getFuncName$7('startService'), params);
414
+ return callNative(getFuncName$8('startService'), params);
415
415
  }
416
416
  function getInstalledAppInfo(params) {
417
- return callNative(getFuncName$7('getInstalledAppInfo'), params);
417
+ return callNative(getFuncName$8('getInstalledAppInfo'), params);
418
418
  }
419
419
  function getInstalledAppsList() {
420
- callNative(getFuncName$7('getInstalledAppsList'), null);
420
+ callNative(getFuncName$8('getInstalledAppsList'), null);
421
421
  }
422
422
  function execActionString(action) {
423
- return callNative(getFuncName$7('execActionString'), action);
423
+ return callNative(getFuncName$8('execActionString'), action);
424
424
  }
425
425
  var app = {
426
426
  getUserInfo: getUserInfo,
@@ -435,62 +435,66 @@ var app = {
435
435
  execActionString: execActionString,
436
436
  };
437
437
 
438
- var moduleName$6 = 'system';
439
- function getFuncName$6(name) {
440
- return moduleName$6 + '_' + name;
438
+ var moduleName$7 = 'system';
439
+ function getFuncName$7(name) {
440
+ return moduleName$7 + '_' + name;
441
441
  }
442
442
  // 告知宿主,小程序或者网页已经准备好
443
443
  function ready() {
444
- return callNative(getFuncName$6('ready'), null);
444
+ return callNative(getFuncName$7('ready'), null);
445
445
  }
446
446
  // 获取启动参数
447
447
  function getStartupParams() {
448
- return callNative(getFuncName$6('getStartupParams'), null);
448
+ return callNative(getFuncName$7('getStartupParams'), null);
449
449
  }
450
450
  // 获取设备信息
451
451
  function getDeviceInfo() {
452
- return callNative(getFuncName$6('getDeviceInfo'), null);
452
+ return callNative(getFuncName$7('getDeviceInfo'), null);
453
453
  }
454
454
  // 获取显示屏幕信息
455
455
  function getDisplayInfo() {
456
- return callNative(getFuncName$6('getDisplayInfo'), null);
456
+ return callNative(getFuncName$7('getDisplayInfo'), null);
457
457
  }
458
458
  // 获取 android property 的值
459
459
  function getProperty(key) {
460
- return callNative(getFuncName$6('getProperty'), { propName: key });
460
+ return callNative(getFuncName$7('getProperty'), { propName: key });
461
461
  }
462
462
  // 检查 JS-API 是否已经实现
463
463
  function checkApi(apiName) {
464
- return callNative(getFuncName$6('checkApi'), { apiName: apiName });
464
+ return callNative(getFuncName$7('checkApi'), { apiName: apiName });
465
465
  }
466
466
  // 获取本地字体的路径
467
467
  function getFontPath(fontFileName) {
468
- return callNative(getFuncName$6('getFontPath'), { fontFileName: fontFileName });
468
+ return callNative(getFuncName$7('getFontPath'), { fontFileName: fontFileName });
469
469
  }
470
470
  // 设置屏幕是否常亮
471
471
  function setKeepScreenOn(enable) {
472
- return callNative(getFuncName$6('setKeepScreenOn'), { enable: enable });
472
+ return callNative(getFuncName$7('setKeepScreenOn'), { enable: enable });
473
473
  }
474
474
  // 添加事件监听
475
- function addEventListener(eventName, callback, options) {
475
+ function addEventListener$1(eventName, callback, options) {
476
476
  if (options === void 0) { options = {}; }
477
- return callWithPersistentCallBack(getFuncName$6('addEventListener'), { callbackId: eventName, options: options }, eventName, callback);
477
+ return callWithPersistentCallBack(getFuncName$7('addEventListener'), { callbackId: eventName, options: options }, eventName, callback);
478
478
  }
479
479
  // 删除事件监听
480
- function removeEventListener(eventName, callback, options) {
480
+ function removeEventListener$1(eventName, callback, options) {
481
481
  if (options === void 0) { options = {}; }
482
482
  var ret = deletePersistentCallBack(eventName, callback);
483
483
  if (ret) {
484
- return callNative(getFuncName$6('removeEventListener'), { callbackId: eventName, options: options });
484
+ return callNative(getFuncName$7('removeEventListener'), { callbackId: eventName, options: options });
485
485
  }
486
486
  return new Promise(function (resolve) { resolve(); });
487
487
  }
488
488
  function sendBroadcast(params) {
489
- return callNative(getFuncName$6('sendBroadcast'), params);
489
+ return callNative(getFuncName$7('sendBroadcast'), params);
490
490
  }
491
491
  // 声明本页面接收并处理系统级的按键(如:返回、HOME、MENU 键)
492
- function enableSystemKey(params) {
493
- return callNative(getFuncName$6('enableSystemKey'), params);
492
+ function registerKeys(params) {
493
+ return callNative(getFuncName$7('registerKeys'), params || { keys: [] });
494
+ }
495
+ // 声明本页面接收并处理系统级的按键(如:返回、HOME、MENU 键)
496
+ function unregisterKeys(params) {
497
+ return callNative(getFuncName$7('unregisterKeys'), params || { keys: [] });
494
498
  }
495
499
  var system = {
496
500
  ready: ready,
@@ -501,33 +505,33 @@ var system = {
501
505
  checkApi: checkApi,
502
506
  getFontPath: getFontPath,
503
507
  setKeepScreenOn: setKeepScreenOn,
504
- addEventListener: addEventListener,
505
- removeEventListener: removeEventListener,
508
+ addEventListener: addEventListener$1,
509
+ removeEventListener: removeEventListener$1,
506
510
  sendBroadcast: sendBroadcast,
507
- //registerKeysOrUnregisterKeys
508
- //sendEvent
509
- enableSystemKey: enableSystemKey,
511
+ registerKeys: registerKeys,
512
+ unregisterKeys: unregisterKeys,
513
+ //sendEvent
510
514
  };
511
515
 
512
- var moduleName$5 = 'storage';
513
- function getFuncName$5(name) {
514
- return moduleName$5 + '_' + name;
516
+ var moduleName$6 = 'storage';
517
+ function getFuncName$6(name) {
518
+ return moduleName$6 + '_' + name;
515
519
  }
516
520
  function setKey(key, value, namespace) {
517
521
  if (namespace === void 0) { namespace = ''; }
518
- return callNative(getFuncName$5('setKey'), { key: key, value: value, namespace: namespace });
522
+ return callNative(getFuncName$6('setKey'), { key: key, value: value, namespace: namespace });
519
523
  }
520
524
  function getKey(key, namespace) {
521
525
  if (namespace === void 0) { namespace = ''; }
522
- return callNative(getFuncName$5('getKey'), { key: key, namespace: namespace });
526
+ return callNative(getFuncName$6('getKey'), { key: key, namespace: namespace });
523
527
  }
524
528
  function deleteKey(key, namespace) {
525
529
  if (namespace === void 0) { namespace = ''; }
526
- return callNative(getFuncName$5('deleteKey'), { key: key, namespace: namespace });
530
+ return callNative(getFuncName$6('deleteKey'), { key: key, namespace: namespace });
527
531
  }
528
532
  function clearAllKeys(namespace) {
529
533
  if (namespace === void 0) { namespace = ''; }
530
- return callNative(getFuncName$5('clearAllKeys'), { namespace: namespace });
534
+ return callNative(getFuncName$6('clearAllKeys'), { namespace: namespace });
531
535
  }
532
536
  var storage = {
533
537
  setKey: setKey,
@@ -536,54 +540,54 @@ var storage = {
536
540
  clearAllKeys: clearAllKeys
537
541
  };
538
542
 
539
- var moduleName$4 = 'audio';
540
- function getFuncName$4(name) {
541
- return moduleName$4 + '_' + name;
543
+ var moduleName$5 = 'audio';
544
+ function getFuncName$5(name) {
545
+ return moduleName$5 + '_' + name;
542
546
  }
543
547
  // 播放器,播放新的URL或者本地文件系统的路径
544
548
  function playNew(path) {
545
- return callNative(getFuncName$4('playNew'), { path: path });
549
+ return callNative(getFuncName$5('playNew'), { path: path });
546
550
  }
547
551
  // 播放器,停止播放
548
552
  function stop$1() {
549
- return callNative(getFuncName$4('stop'), null);
553
+ return callNative(getFuncName$5('stop'), null);
550
554
  }
551
555
  // 播放器,是否正在播放中
552
556
  function isPlaying$1() {
553
- return callNative(getFuncName$4('isPlaying'), null);
557
+ return callNative(getFuncName$5('isPlaying'), null);
554
558
  }
555
559
  // 播放器,是否准备好
556
560
  function hasPrepared$1() {
557
- return callNative(getFuncName$4('hasPrepared'), null);
561
+ return callNative(getFuncName$5('hasPrepared'), null);
558
562
  }
559
563
  // 播放器,获取总时长
560
564
  function getDuration$1() {
561
- return callNative(getFuncName$4('getDuration'), null);
565
+ return callNative(getFuncName$5('getDuration'), null);
562
566
  }
563
567
  // 播放器,获取当前进度值
564
568
  function getCurrentPosition$1() {
565
- return callNative(getFuncName$4('getCurrentPosition'), null);
569
+ return callNative(getFuncName$5('getCurrentPosition'), null);
566
570
  }
567
571
  // 播放器,获取播放状态,返回的value为字符串来标识播放状态
568
572
  // 例如:Idle, Initialized, Preparing, Prepared, Started, Paused, Stopped, Completed, Error, End
569
573
  function getPlayerState$1() {
570
- return callNative(getFuncName$4('getPlayerState'), null);
574
+ return callNative(getFuncName$5('getPlayerState'), null);
571
575
  }
572
576
  // 播放器,暂停播放
573
577
  function pause$1() {
574
- return callNative(getFuncName$4('pause'), null);
578
+ return callNative(getFuncName$5('pause'), null);
575
579
  }
576
580
  // 播放器,启动播放或者从暂停恢复播放
577
581
  function start$1() {
578
- return callNative(getFuncName$4('start'), null);
582
+ return callNative(getFuncName$5('start'), null);
579
583
  }
580
584
  // 播放器,重新播放
581
585
  function rePlay$1() {
582
- return callNative(getFuncName$4('rePlay'), null);
586
+ return callNative(getFuncName$5('rePlay'), null);
583
587
  }
584
588
  // 播放器,seek
585
589
  function seekTo$1(position) {
586
- return callNative(getFuncName$4('seekTo'), { position: Math.floor(position) });
590
+ return callNative(getFuncName$5('seekTo'), { position: Math.floor(position) });
587
591
  }
588
592
  // 播放器,设置单片循环模式
589
593
  // isLooping: 是否循环播放
@@ -591,16 +595,16 @@ function seekTo$1(position) {
591
595
  // 会无感知重播,即重播时,不会调idle/ preparing/ prepared等开始播放之前的状态)
592
596
  function setLooping$1(isLooping, silentLoop) {
593
597
  if (silentLoop === void 0) { silentLoop = false; }
594
- return callNative(getFuncName$4('setLooping'), { isLooping: isLooping, silentLoop: silentLoop });
598
+ return callNative(getFuncName$5('setLooping'), { isLooping: isLooping, silentLoop: silentLoop });
595
599
  }
596
600
  // 设置音量
597
601
  function setVolume(volume) {
598
- return callNative(getFuncName$4('setVolume'), { volume: volume });
602
+ return callNative(getFuncName$5('setVolume'), { volume: volume });
599
603
  }
600
604
  // 设置播放内核
601
605
  // 值: DefaultPlayer, MediaPlayer, SocPlayer, ExoPlayer
602
606
  function setPlayerCore$1(core) {
603
- return callNative(getFuncName$4('setPlayerCore'), { core: core });
607
+ return callNative(getFuncName$5('setPlayerCore'), { core: core });
604
608
  }
605
609
  var audio = {
606
610
  playNew: playNew,
@@ -619,62 +623,62 @@ var audio = {
619
623
  setPlayerCore: setPlayerCore$1,
620
624
  };
621
625
 
622
- var moduleName$3 = 'video';
623
- function getFuncName$3(name) {
624
- return moduleName$3 + '_' + name;
626
+ var moduleName$4 = 'video';
627
+ function getFuncName$4(name) {
628
+ return moduleName$4 + '_' + name;
625
629
  }
626
630
  // 设置视频播放窗口的位置与宽高
627
631
  function setVideoLayout(width, height, x, y) {
628
- return callNative(getFuncName$3('setVideoLayout'), { x: Number(x), y: Number(y), w: Number(width), h: Number(height) });
632
+ return callNative(getFuncName$4('setVideoLayout'), { x: Number(x), y: Number(y), w: Number(width), h: Number(height) });
629
633
  }
630
634
  // 设置视频窗口是否显示
631
635
  function setVideoVisible(show) {
632
- return callNative(getFuncName$3('setVideoVisible'), { visible: show });
636
+ return callNative(getFuncName$4('setVideoVisible'), { visible: show });
633
637
  }
634
638
  // 播放器,播放新的URL
635
639
  function playNewUrl(url) {
636
- return callNative(getFuncName$3('playNewUrl'), { url: url });
640
+ return callNative(getFuncName$4('playNewUrl'), { url: url });
637
641
  }
638
642
  // 播放器,播放新的本地文件路径
639
643
  function playNewFile(path) {
640
- return callNative(getFuncName$3('playNewFile'), { path: path });
644
+ return callNative(getFuncName$4('playNewFile'), { path: path });
641
645
  }
642
646
  // 播放器,停止播放
643
647
  function stop() {
644
- return callNative(getFuncName$3('stop'), null);
648
+ return callNative(getFuncName$4('stop'), null);
645
649
  }
646
650
  // 播放器,暂停播放
647
651
  function pause() {
648
- return callNative(getFuncName$3('pause'), null);
652
+ return callNative(getFuncName$4('pause'), null);
649
653
  }
650
654
  // 播放器,启动播放或者从暂停恢复播放
651
655
  function start() {
652
- return callNative(getFuncName$3('start'), null);
656
+ return callNative(getFuncName$4('start'), null);
653
657
  }
654
658
  // 播放器,seek
655
659
  function seekTo(position) {
656
- return callNative(getFuncName$3('seekTo'), { position: Math.floor(position) });
660
+ return callNative(getFuncName$4('seekTo'), { position: Math.floor(position) });
657
661
  }
658
662
  // 播放器,是否准备好
659
663
  function hasPrepared() {
660
- return callNative(getFuncName$3('hasPrepared'), null);
664
+ return callNative(getFuncName$4('hasPrepared'), null);
661
665
  }
662
666
  // 播放器,是否正在播放中
663
667
  function isPlaying() {
664
- return callNative(getFuncName$3('isPlaying'), null);
668
+ return callNative(getFuncName$4('isPlaying'), null);
665
669
  }
666
670
  // 播放器,获取总时长
667
671
  function getDuration() {
668
- return callNative(getFuncName$3('getDuration'), null);
672
+ return callNative(getFuncName$4('getDuration'), null);
669
673
  }
670
674
  // 播放器,获取当前进度值
671
675
  function getCurrentPosition() {
672
- return callNative(getFuncName$3('getCurrentPosition'), null);
676
+ return callNative(getFuncName$4('getCurrentPosition'), null);
673
677
  }
674
678
  // 播放器,获取播放状态,返回的value为字符串来标识播放状态
675
679
  // 例如:Idle, Initialized, Preparing, Prepared, Started, Paused, Stopped, Completed, Error, End
676
680
  function getPlayerState() {
677
- return callNative(getFuncName$3('getPlayerState'), null);
681
+ return callNative(getFuncName$4('getPlayerState'), null);
678
682
  }
679
683
  // 播放器,设置单片循环模式
680
684
  // isLooping: 是否循环播放
@@ -682,40 +686,40 @@ function getPlayerState() {
682
686
  // 会无感知重播,即重播时,不会调idle/ preparing/ prepared等开始播放之前的状态)
683
687
  function setLooping(isLooping, silentLoop) {
684
688
  if (silentLoop === void 0) { silentLoop = false; }
685
- return callNative(getFuncName$3('setLooping'), { isLooping: isLooping, silentLoop: silentLoop });
689
+ return callNative(getFuncName$4('setLooping'), { isLooping: isLooping, silentLoop: silentLoop });
686
690
  }
687
691
  // 播放器,设置自动屏保锁,即:开始或恢复播放->锁屏保,停止或暂停播放->释放屏保锁 默认关闭
688
692
  function setAutoWakeLock(autoWakeLock) {
689
- return callNative(getFuncName$3('setAutoWakeLock'), { autoWakeLock: autoWakeLock });
693
+ return callNative(getFuncName$4('setAutoWakeLock'), { autoWakeLock: autoWakeLock });
690
694
  }
691
695
  // 播放器,重新播放
692
696
  function rePlay() {
693
- return callNative(getFuncName$3('rePlay'), null);
697
+ return callNative(getFuncName$4('rePlay'), null);
694
698
  }
695
699
  // 播放器,设置是否自动播放,即 play ready 后音视频自动播放 默认开启
696
700
  function setPlayWhenReady(playWhenReady) {
697
701
  if (playWhenReady === void 0) { playWhenReady = true; }
698
- return callNative(getFuncName$3('setPlayWhenReady'), { playWhenReady: playWhenReady });
702
+ return callNative(getFuncName$4('setPlayWhenReady'), { playWhenReady: playWhenReady });
699
703
  }
700
704
  // 获取当前设置的播放内核, 有可能会返回 DefaultPlayer
701
705
  // 值: DefaultPlayer, MediaPlayer, SocPlayer, ExoPlayer
702
706
  function getPlayerCore() {
703
- return callNative(getFuncName$3('getPlayerCore'), null);
707
+ return callNative(getFuncName$4('getPlayerCore'), null);
704
708
  }
705
709
  // 获取实际的播放内核, 部分内核如:最佳内核,实际上是在各个内核中进行选择,不会返回 DefaultPlayer
706
710
  // 值: MediaPlayer, SocPlayer, ExoPlayer
707
711
  function getRealPlayerCore() {
708
- return callNative(getFuncName$3('getRealPlayerCore'), null);
712
+ return callNative(getFuncName$4('getRealPlayerCore'), null);
709
713
  }
710
714
  // 设置播放内核
711
715
  // 值: DefaultPlayer, MediaPlayer, SocPlayer, ExoPlayer
712
716
  function setPlayerCore(core) {
713
- return callNative(getFuncName$3('setPlayerCore'), { core: core });
717
+ return callNative(getFuncName$4('setPlayerCore'), { core: core });
714
718
  }
715
719
  // 设置渲染模式
716
720
  // 值: SurfaceView, TextureView
717
721
  function setRenderType(playerRender) {
718
- return callNative(getFuncName$3('setRenderType'), { playerRender: playerRender });
722
+ return callNative(getFuncName$4('setRenderType'), { playerRender: playerRender });
719
723
  }
720
724
  var video = {
721
725
  setVideoLayout: setVideoLayout,
@@ -741,9 +745,9 @@ var video = {
741
745
  setRenderType: setRenderType,
742
746
  };
743
747
 
744
- var moduleName$2 = 'fs';
745
- function getFuncName$2(name) {
746
- return moduleName$2 + '_' + name;
748
+ var moduleName$3 = 'fs';
749
+ function getFuncName$3(name) {
750
+ return moduleName$3 + '_' + name;
747
751
  }
748
752
  // 读取文件并返回文件的所有内容
749
753
  // 参数:
@@ -751,7 +755,7 @@ function getFuncName$2(name) {
751
755
  // base64Flag: 是否以base64编码方式返回, 如果读取文本文件,则应该设置 base64Flag = false,如果读取二进制文件,则应该设置 base64Flag = true
752
756
  function readAllContent(path, base64Flag) {
753
757
  if (base64Flag === void 0) { base64Flag = false; }
754
- return callNative(getFuncName$2('readAllContent'), { path: path, base64Flag: base64Flag });
758
+ return callNative(getFuncName$3('readAllContent'), { path: path, base64Flag: base64Flag });
755
759
  }
756
760
  // 将内容全部写入文件
757
761
  // 参数:
@@ -760,114 +764,114 @@ function readAllContent(path, base64Flag) {
760
764
  // base64Flag: 是否以base64编码方式传输content, 如果写文本文件,则应该设置 base64Flag = false,如果写入二进制文件,则应该设置 base64Flag = true
761
765
  function writeAllContent(path, content, base64Flag) {
762
766
  if (base64Flag === void 0) { base64Flag = false; }
763
- return callNative(getFuncName$2('writeAllContent'), { path: path, content: content, base64Flag: base64Flag });
767
+ return callNative(getFuncName$3('writeAllContent'), { path: path, content: content, base64Flag: base64Flag });
764
768
  }
765
769
  // 获取应用基本目录的全路径名
766
770
  function getAppBaseDir() {
767
- return callNative(getFuncName$2('getAppBaseDir'), null);
771
+ return callNative(getFuncName$3('getAppBaseDir'), null);
768
772
  }
769
773
  // 获取 Cache 目录的全路径名
770
774
  function getAppCacheDir() {
771
- return callNative(getFuncName$2('getAppCacheDir'), null);
775
+ return callNative(getFuncName$3('getAppCacheDir'), null);
772
776
  }
773
777
  // 构建一个临时文件名,返回该文件的绝对路径的全文件路径名
774
778
  // 参数:
775
779
  // fileName: 指定临时文件的基本名,如果不指定,会默认随机生成一个文件名
776
780
  function makeCacheFile(fileName) {
777
781
  if (fileName === void 0) { fileName = ''; }
778
- return callNative(getFuncName$2('makeCacheFile'), { fileName: fileName });
782
+ return callNative(getFuncName$3('makeCacheFile'), { fileName: fileName });
779
783
  }
780
784
  // 构建一个正常文件名,返回该文件的绝对路径的全文件路径名
781
785
  // 参数:
782
786
  // fileName: 指定文件的基本名,如果不指定,会默认随机生成一个文件名
783
787
  function makeNormalFile(fileName) {
784
788
  if (fileName === void 0) { fileName = ''; }
785
- return callNative(getFuncName$2('makeNormalFile'), { fileName: fileName });
789
+ return callNative(getFuncName$3('makeNormalFile'), { fileName: fileName });
786
790
  }
787
791
  // 检测一个文件或者目录是否存在
788
792
  // 参数:
789
793
  // path: 指定路径
790
794
  function exists(path) {
791
- return callNative(getFuncName$2('exists'), { path: path });
795
+ return callNative(getFuncName$3('exists'), { path: path });
792
796
  }
793
797
  // 检测一个路径是否为一个普通文件
794
798
  // 参数:
795
799
  // path: 指定路径
796
800
  function isFile(path) {
797
- return callNative(getFuncName$2('isFile'), { path: path });
801
+ return callNative(getFuncName$3('isFile'), { path: path });
798
802
  }
799
803
  // 检测一个路径是否为一个目录
800
804
  // 参数:
801
805
  // path: 指定路径
802
806
  function isDirectory(path) {
803
- return callNative(getFuncName$2('isDirectory'), { path: path });
807
+ return callNative(getFuncName$3('isDirectory'), { path: path });
804
808
  }
805
809
  // 检测一个路径表示的文件或目录 是否是隐藏的
806
810
  // 参数:
807
811
  // path: 指定路径
808
812
  function isHidden(path) {
809
- return callNative(getFuncName$2('isHidden'), { path: path });
813
+ return callNative(getFuncName$3('isHidden'), { path: path });
810
814
  }
811
815
  // 检测一个路径表示的文件或目录 是否可读
812
816
  // 参数:
813
817
  // path: 指定路径
814
818
  function canRead(path) {
815
- return callNative(getFuncName$2('canRead'), { path: path });
819
+ return callNative(getFuncName$3('canRead'), { path: path });
816
820
  }
817
821
  // 检测一个路径表示的文件或目录 是否可写
818
822
  // 参数:
819
823
  // path: 指定路径
820
824
  function canWrite(path) {
821
- return callNative(getFuncName$2('canWrite'), { path: path });
825
+ return callNative(getFuncName$3('canWrite'), { path: path });
822
826
  }
823
827
  // 检测一个路径表示的文件或目录 是否可执行
824
828
  // 参数:
825
829
  // path: 指定路径
826
830
  function canExecute(path) {
827
- return callNative(getFuncName$2('canExecute'), { path: path });
831
+ return callNative(getFuncName$3('canExecute'), { path: path });
828
832
  }
829
833
  // 检测一个路径表示的文件或目录 的最后修改的时间,返回时间戳(1970年开始的秒数)
830
834
  // 参数:
831
835
  // path: 指定路径
832
836
  function lastModified(path) {
833
- return callNative(getFuncName$2('lastModified'), { path: path });
837
+ return callNative(getFuncName$3('lastModified'), { path: path });
834
838
  }
835
839
  // 删除文件
836
840
  // 参数:
837
841
  // path: 指定路径
838
842
  function deleteIt(path) {
839
- return callNative(getFuncName$2('delete'), { path: path });
843
+ return callNative(getFuncName$3('delete'), { path: path });
840
844
  }
841
845
  // 新建目录
842
846
  // 参数:
843
847
  // path: 指定路径
844
848
  function mkdir(path) {
845
- return callNative(getFuncName$2('mkdir'), { path: path });
849
+ return callNative(getFuncName$3('mkdir'), { path: path });
846
850
  }
847
851
  // 新建目录 (如果父目录补存在则一并新建所有尚未存在的父目录)
848
852
  // 参数:
849
853
  // path: 指定路径
850
854
  function mkdirs(path) {
851
- return callNative(getFuncName$2('mkdirs'), { path: path });
855
+ return callNative(getFuncName$3('mkdirs'), { path: path });
852
856
  }
853
857
  // 改名
854
858
  // 参数:
855
859
  // from: 指定源路径
856
860
  // to: 指定目标路径
857
861
  function rename(from, to) {
858
- return callNative(getFuncName$2('rename'), { from: from, to: to });
862
+ return callNative(getFuncName$3('rename'), { from: from, to: to });
859
863
  }
860
864
  // 将相对路径的转换为全路径
861
865
  // 参数:
862
866
  // path: 指定路径
863
867
  function getAbsolutePath(path) {
864
- return callNative(getFuncName$2('getAbsolutePath'), { path: path });
868
+ return callNative(getFuncName$3('getAbsolutePath'), { path: path });
865
869
  }
866
870
  // 指定路径创建新文件
867
871
  // 参数:
868
872
  // path: 指定路径
869
873
  function createNewFile(path) {
870
- return callNative(getFuncName$2('createNewFile'), { path: path });
874
+ return callNative(getFuncName$3('createNewFile'), { path: path });
871
875
  }
872
876
  // 设置可读属性
873
877
  // 参数:
@@ -875,7 +879,7 @@ function createNewFile(path) {
875
879
  // value: 是否可读
876
880
  function setReadable(path, value) {
877
881
  if (value === void 0) { value = true; }
878
- return callNative(getFuncName$2('setReadable'), { path: path, value: value });
882
+ return callNative(getFuncName$3('setReadable'), { path: path, value: value });
879
883
  }
880
884
  // 设置可写属性
881
885
  // 参数:
@@ -883,7 +887,7 @@ function setReadable(path, value) {
883
887
  // value: 是否可写
884
888
  function setWritable(path, value) {
885
889
  if (value === void 0) { value = true; }
886
- return callNative(getFuncName$2('setWritable'), { path: path, value: value });
890
+ return callNative(getFuncName$3('setWritable'), { path: path, value: value });
887
891
  }
888
892
  // 设置可执行属性
889
893
  // 参数:
@@ -891,7 +895,7 @@ function setWritable(path, value) {
891
895
  // value: 是否可执行
892
896
  function setExecutable(path, value) {
893
897
  if (value === void 0) { value = true; }
894
- return callNative(getFuncName$2('setExecutable'), { path: path, value: value });
898
+ return callNative(getFuncName$3('setExecutable'), { path: path, value: value });
895
899
  }
896
900
  // 设置文件最后修改的时间
897
901
  // 参数:
@@ -899,13 +903,13 @@ function setExecutable(path, value) {
899
903
  // value: 时间戳
900
904
  function setLastModified(path, value) {
901
905
  if (value === void 0) { value = 0; }
902
- return callNative(getFuncName$2('setLastModified'), { path: path, value: value });
906
+ return callNative(getFuncName$3('setLastModified'), { path: path, value: value });
903
907
  }
904
908
  // 读取目录,返回该目录下的文件列表
905
909
  // 参数:
906
910
  // path: 指定路径
907
911
  function list(path) {
908
- return callNative(getFuncName$2('list'), { path: path });
912
+ return callNative(getFuncName$3('list'), { path: path });
909
913
  }
910
914
  var fs = {
911
915
  readAllContent: readAllContent,
@@ -935,19 +939,19 @@ var fs = {
935
939
  list: list
936
940
  };
937
941
 
938
- var moduleName$1 = 'pag';
939
- function getFuncName$1(name) {
940
- return moduleName$1 + '_' + name;
942
+ var moduleName$2 = 'pag';
943
+ function getFuncName$2(name) {
944
+ return moduleName$2 + '_' + name;
941
945
  }
942
946
  // 播放PAG动画
943
947
  // repeat: 循环次数 -1 表示无限
944
948
  //
945
949
  function startNewPagAni(params) {
946
- return callNative(getFuncName$1('startNewPagAni'), params);
950
+ return callNative(getFuncName$2('startNewPagAni'), params);
947
951
  }
948
952
  // 停止PAG动画,并消失
949
953
  function stopPagAni() {
950
- return callNative(getFuncName$1('stopPagAni'), null);
954
+ return callNative(getFuncName$2('stopPagAni'), null);
951
955
  }
952
956
  function setPagVisibility(visible) {
953
957
  if (visible === void 0) { visible = true; }
@@ -964,10 +968,10 @@ function setPagVisibility(visible) {
964
968
  else {
965
969
  value = visible;
966
970
  }
967
- return callNative(getFuncName$1('setPagVisibility'), { visible: value });
971
+ return callNative(getFuncName$2('setPagVisibility'), { visible: value });
968
972
  }
969
973
  function setPagXY(x, y) {
970
- return callNative(getFuncName$1('setPagXY'), { x: x, y: y });
974
+ return callNative(getFuncName$2('setPagXY'), { x: x, y: y });
971
975
  }
972
976
  // // 播报 TTS 文本语音
973
977
  // export function sendTts(text: string, ttsId: string): Promise<any> {
@@ -1010,6 +1014,58 @@ var pag = {
1010
1014
  // clearBackground,
1011
1015
  };
1012
1016
 
1017
+ var moduleName$1 = 'voice';
1018
+ function getFuncName$1(name) {
1019
+ return moduleName$1 + '_' + name;
1020
+ }
1021
+ // 开启语音输入
1022
+ function enableVoiceInput() {
1023
+ return callNative(getFuncName$1('enableVoiceInput'), {});
1024
+ }
1025
+ // 停止TTS播报
1026
+ //
1027
+ function stopTts$1() {
1028
+ return callNative(getFuncName$1('stopTts'), {});
1029
+ }
1030
+ // 开始 TTS 播报
1031
+ function sendTts$1(text, ttsId) {
1032
+ return callNative(getFuncName$1('sendTts'), { text: text, ttsId: ttsId });
1033
+ }
1034
+ // 流式播报 TTS
1035
+ function sendStreamTts$1(text, ttsId, isFirst, isEnd) {
1036
+ return callNative(getFuncName$1('sendStreamTts'), { text: text, ttsId: ttsId, isFirst: isFirst, isEnd: isEnd });
1037
+ }
1038
+ // 设置播放TTS的人声
1039
+ function setTtsSpeaker(speaker) {
1040
+ return callNative(getFuncName$1('setTtsSpeaker'), { speaker: speaker });
1041
+ }
1042
+ var voice = {
1043
+ enableVoiceInput: enableVoiceInput,
1044
+ stopTts: stopTts$1,
1045
+ sendTts: sendTts$1,
1046
+ sendStreamTts: sendStreamTts$1,
1047
+ setTtsSpeaker: setTtsSpeaker,
1048
+ };
1049
+
1050
+ // 添加事件监听
1051
+ function addEventListener(eventName, callback, options) {
1052
+ if (options === void 0) { options = {}; }
1053
+ return callWithPersistentCallBack('system_' + 'addEventListener', { callbackId: eventName, options: options }, eventName, callback);
1054
+ }
1055
+ // 删除事件监听
1056
+ function removeEventListener(eventName, callback, options) {
1057
+ if (options === void 0) { options = {}; }
1058
+ var ret = deletePersistentCallBack(eventName, callback);
1059
+ if (ret) {
1060
+ return callNative('system_' + 'removeEventListener', { callbackId: eventName, options: options });
1061
+ }
1062
+ return new Promise(function (resolve) { resolve(); });
1063
+ }
1064
+ var event = {
1065
+ addEventListener: addEventListener,
1066
+ removeEventListener: removeEventListener,
1067
+ };
1068
+
1013
1069
  var moduleName = 'tts';
1014
1070
  function getFuncName(name) {
1015
1071
  return moduleName + '_' + name;
@@ -1080,8 +1136,10 @@ var index = {
1080
1136
  audio: audio,
1081
1137
  video: video,
1082
1138
  pag: pag,
1083
- tts: tts,
1139
+ voice: voice,
1140
+ event: event,
1084
1141
  fs: fs,
1142
+ tts: tts,
1085
1143
  isRunInAppBrowser: isRunInAppBrowser
1086
1144
  };
1087
1145
 
@@ -0,0 +1,7 @@
1
+ export declare function addEventListener(eventName: string, callback: Function, options?: object): Promise<any>;
2
+ export declare function removeEventListener(eventName: string, callback: Function, options?: object): Promise<any>;
3
+ declare const _default: {
4
+ addEventListener: typeof addEventListener;
5
+ removeEventListener: typeof removeEventListener;
6
+ };
7
+ export default _default;
package/lib/index.d.ts CHANGED
@@ -37,7 +37,8 @@ declare const _default: {
37
37
  addEventListener: typeof import("./system").addEventListener;
38
38
  removeEventListener: typeof import("./system").removeEventListener;
39
39
  sendBroadcast: typeof import("./system").sendBroadcast;
40
- enableSystemKey: typeof import("./system").enableSystemKey;
40
+ registerKeys: typeof import("./system").registerKeys;
41
+ unregisterKeys: typeof import("./system").unregisterKeys;
41
42
  };
42
43
  storage: {
43
44
  setKey: typeof import("./storage").setKey;
@@ -90,10 +91,16 @@ declare const _default: {
90
91
  setPagVisibility: typeof import("./pag").setPagVisibility;
91
92
  setPagXY: typeof import("./pag").setPagXY;
92
93
  };
93
- tts: {
94
- stopTts: typeof import("./tts").stopTts;
95
- sendTts: typeof import("./tts").sendTts;
96
- sendStreamTts: typeof import("./tts").sendStreamTts;
94
+ voice: {
95
+ enableVoiceInput: typeof import("./voice").enableVoiceInput;
96
+ stopTts: typeof import("./voice").stopTts;
97
+ sendTts: typeof import("./voice").sendTts;
98
+ sendStreamTts: typeof import("./voice").sendStreamTts;
99
+ setTtsSpeaker: typeof import("./voice").setTtsSpeaker;
100
+ };
101
+ event: {
102
+ addEventListener: typeof import("./event").addEventListener;
103
+ removeEventListener: typeof import("./event").removeEventListener;
97
104
  };
98
105
  fs: {
99
106
  readAllContent: typeof import("./file").readAllContent;
@@ -122,6 +129,11 @@ declare const _default: {
122
129
  setLastModified: typeof import("./file").setLastModified;
123
130
  list: typeof import("./file").list;
124
131
  };
132
+ tts: {
133
+ stopTts: typeof import("./tts").stopTts;
134
+ sendTts: typeof import("./tts").sendTts;
135
+ sendStreamTts: typeof import("./tts").sendStreamTts;
136
+ };
125
137
  isRunInAppBrowser: typeof isRunInAppBrowser;
126
138
  };
127
139
  export default _default;
@@ -19,7 +19,8 @@ export declare function setKeepScreenOn(enable: boolean): Promise<any>;
19
19
  export declare function addEventListener(eventName: string, callback: Function, options?: object): Promise<any>;
20
20
  export declare function removeEventListener(eventName: string, callback: Function, options?: object): Promise<any>;
21
21
  export declare function sendBroadcast(params: IntentParam): Promise<any>;
22
- export declare function enableSystemKey(params: SystemKeyParam | null): Promise<any>;
22
+ export declare function registerKeys(params: SystemKeyParam | null): Promise<any>;
23
+ export declare function unregisterKeys(params: SystemKeyParam | null): Promise<any>;
23
24
  declare const _default: {
24
25
  ready: typeof ready;
25
26
  getStartupParams: typeof getStartupParams;
@@ -32,6 +33,7 @@ declare const _default: {
32
33
  addEventListener: typeof addEventListener;
33
34
  removeEventListener: typeof removeEventListener;
34
35
  sendBroadcast: typeof sendBroadcast;
35
- enableSystemKey: typeof enableSystemKey;
36
+ registerKeys: typeof registerKeys;
37
+ unregisterKeys: typeof unregisterKeys;
36
38
  };
37
39
  export default _default;
@@ -1,11 +1,3 @@
1
- export interface StartPAGParam {
2
- path: string;
3
- repeat: number;
4
- x: number;
5
- y: number;
6
- width: number;
7
- height: number;
8
- }
9
1
  export declare function stopTts(): Promise<any>;
10
2
  export declare function sendTts(text: string, ttsId: string): Promise<any>;
11
3
  export declare function sendStreamTts(text: string, ttsId: string, isFirst: boolean, isEnd: boolean): Promise<any>;
@@ -0,0 +1,13 @@
1
+ export declare function enableVoiceInput(): Promise<any>;
2
+ export declare function stopTts(): Promise<any>;
3
+ export declare function sendTts(text: string, ttsId: string): Promise<any>;
4
+ export declare function sendStreamTts(text: string, ttsId: string, isFirst: boolean, isEnd: boolean): Promise<any>;
5
+ export declare function setTtsSpeaker(speaker: string): Promise<any>;
6
+ declare const _default: {
7
+ enableVoiceInput: typeof enableVoiceInput;
8
+ stopTts: typeof stopTts;
9
+ sendTts: typeof sendTts;
10
+ sendStreamTts: typeof sendStreamTts;
11
+ setTtsSpeaker: typeof setTtsSpeaker;
12
+ };
13
+ export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ccos/ccsdk-lite",
3
- "version": "1.0.11",
3
+ "version": "1.0.13",
4
4
  "description": "a jssdk for coocaa tv-system",
5
5
  "type": "module",
6
6
  "main": "lib/bundle.js",