@ccos/ccsdk-lite 1.0.12 → 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,66 +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
492
  function registerKeys(params) {
493
- return callNative(getFuncName$6('registerKeys'), params || { keys: [] });
493
+ return callNative(getFuncName$7('registerKeys'), params || { keys: [] });
494
494
  }
495
495
  // 声明本页面接收并处理系统级的按键(如:返回、HOME、MENU 键)
496
496
  function unregisterKeys(params) {
497
- return callNative(getFuncName$6('unregisterKeys'), params || { keys: [] });
497
+ return callNative(getFuncName$7('unregisterKeys'), params || { keys: [] });
498
498
  }
499
499
  var system = {
500
500
  ready: ready,
@@ -505,34 +505,33 @@ var system = {
505
505
  checkApi: checkApi,
506
506
  getFontPath: getFontPath,
507
507
  setKeepScreenOn: setKeepScreenOn,
508
- addEventListener: addEventListener,
509
- removeEventListener: removeEventListener,
508
+ addEventListener: addEventListener$1,
509
+ removeEventListener: removeEventListener$1,
510
510
  sendBroadcast: sendBroadcast,
511
511
  registerKeys: registerKeys,
512
512
  unregisterKeys: unregisterKeys,
513
- //registerKeysOrUnregisterKeys
514
- //sendEvent
513
+ //sendEvent
515
514
  };
516
515
 
517
- var moduleName$5 = 'storage';
518
- function getFuncName$5(name) {
519
- return moduleName$5 + '_' + name;
516
+ var moduleName$6 = 'storage';
517
+ function getFuncName$6(name) {
518
+ return moduleName$6 + '_' + name;
520
519
  }
521
520
  function setKey(key, value, namespace) {
522
521
  if (namespace === void 0) { namespace = ''; }
523
- return callNative(getFuncName$5('setKey'), { key: key, value: value, namespace: namespace });
522
+ return callNative(getFuncName$6('setKey'), { key: key, value: value, namespace: namespace });
524
523
  }
525
524
  function getKey(key, namespace) {
526
525
  if (namespace === void 0) { namespace = ''; }
527
- return callNative(getFuncName$5('getKey'), { key: key, namespace: namespace });
526
+ return callNative(getFuncName$6('getKey'), { key: key, namespace: namespace });
528
527
  }
529
528
  function deleteKey(key, namespace) {
530
529
  if (namespace === void 0) { namespace = ''; }
531
- return callNative(getFuncName$5('deleteKey'), { key: key, namespace: namespace });
530
+ return callNative(getFuncName$6('deleteKey'), { key: key, namespace: namespace });
532
531
  }
533
532
  function clearAllKeys(namespace) {
534
533
  if (namespace === void 0) { namespace = ''; }
535
- return callNative(getFuncName$5('clearAllKeys'), { namespace: namespace });
534
+ return callNative(getFuncName$6('clearAllKeys'), { namespace: namespace });
536
535
  }
537
536
  var storage = {
538
537
  setKey: setKey,
@@ -541,54 +540,54 @@ var storage = {
541
540
  clearAllKeys: clearAllKeys
542
541
  };
543
542
 
544
- var moduleName$4 = 'audio';
545
- function getFuncName$4(name) {
546
- return moduleName$4 + '_' + name;
543
+ var moduleName$5 = 'audio';
544
+ function getFuncName$5(name) {
545
+ return moduleName$5 + '_' + name;
547
546
  }
548
547
  // 播放器,播放新的URL或者本地文件系统的路径
549
548
  function playNew(path) {
550
- return callNative(getFuncName$4('playNew'), { path: path });
549
+ return callNative(getFuncName$5('playNew'), { path: path });
551
550
  }
552
551
  // 播放器,停止播放
553
552
  function stop$1() {
554
- return callNative(getFuncName$4('stop'), null);
553
+ return callNative(getFuncName$5('stop'), null);
555
554
  }
556
555
  // 播放器,是否正在播放中
557
556
  function isPlaying$1() {
558
- return callNative(getFuncName$4('isPlaying'), null);
557
+ return callNative(getFuncName$5('isPlaying'), null);
559
558
  }
560
559
  // 播放器,是否准备好
561
560
  function hasPrepared$1() {
562
- return callNative(getFuncName$4('hasPrepared'), null);
561
+ return callNative(getFuncName$5('hasPrepared'), null);
563
562
  }
564
563
  // 播放器,获取总时长
565
564
  function getDuration$1() {
566
- return callNative(getFuncName$4('getDuration'), null);
565
+ return callNative(getFuncName$5('getDuration'), null);
567
566
  }
568
567
  // 播放器,获取当前进度值
569
568
  function getCurrentPosition$1() {
570
- return callNative(getFuncName$4('getCurrentPosition'), null);
569
+ return callNative(getFuncName$5('getCurrentPosition'), null);
571
570
  }
572
571
  // 播放器,获取播放状态,返回的value为字符串来标识播放状态
573
572
  // 例如:Idle, Initialized, Preparing, Prepared, Started, Paused, Stopped, Completed, Error, End
574
573
  function getPlayerState$1() {
575
- return callNative(getFuncName$4('getPlayerState'), null);
574
+ return callNative(getFuncName$5('getPlayerState'), null);
576
575
  }
577
576
  // 播放器,暂停播放
578
577
  function pause$1() {
579
- return callNative(getFuncName$4('pause'), null);
578
+ return callNative(getFuncName$5('pause'), null);
580
579
  }
581
580
  // 播放器,启动播放或者从暂停恢复播放
582
581
  function start$1() {
583
- return callNative(getFuncName$4('start'), null);
582
+ return callNative(getFuncName$5('start'), null);
584
583
  }
585
584
  // 播放器,重新播放
586
585
  function rePlay$1() {
587
- return callNative(getFuncName$4('rePlay'), null);
586
+ return callNative(getFuncName$5('rePlay'), null);
588
587
  }
589
588
  // 播放器,seek
590
589
  function seekTo$1(position) {
591
- return callNative(getFuncName$4('seekTo'), { position: Math.floor(position) });
590
+ return callNative(getFuncName$5('seekTo'), { position: Math.floor(position) });
592
591
  }
593
592
  // 播放器,设置单片循环模式
594
593
  // isLooping: 是否循环播放
@@ -596,16 +595,16 @@ function seekTo$1(position) {
596
595
  // 会无感知重播,即重播时,不会调idle/ preparing/ prepared等开始播放之前的状态)
597
596
  function setLooping$1(isLooping, silentLoop) {
598
597
  if (silentLoop === void 0) { silentLoop = false; }
599
- return callNative(getFuncName$4('setLooping'), { isLooping: isLooping, silentLoop: silentLoop });
598
+ return callNative(getFuncName$5('setLooping'), { isLooping: isLooping, silentLoop: silentLoop });
600
599
  }
601
600
  // 设置音量
602
601
  function setVolume(volume) {
603
- return callNative(getFuncName$4('setVolume'), { volume: volume });
602
+ return callNative(getFuncName$5('setVolume'), { volume: volume });
604
603
  }
605
604
  // 设置播放内核
606
605
  // 值: DefaultPlayer, MediaPlayer, SocPlayer, ExoPlayer
607
606
  function setPlayerCore$1(core) {
608
- return callNative(getFuncName$4('setPlayerCore'), { core: core });
607
+ return callNative(getFuncName$5('setPlayerCore'), { core: core });
609
608
  }
610
609
  var audio = {
611
610
  playNew: playNew,
@@ -624,62 +623,62 @@ var audio = {
624
623
  setPlayerCore: setPlayerCore$1,
625
624
  };
626
625
 
627
- var moduleName$3 = 'video';
628
- function getFuncName$3(name) {
629
- return moduleName$3 + '_' + name;
626
+ var moduleName$4 = 'video';
627
+ function getFuncName$4(name) {
628
+ return moduleName$4 + '_' + name;
630
629
  }
631
630
  // 设置视频播放窗口的位置与宽高
632
631
  function setVideoLayout(width, height, x, y) {
633
- 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) });
634
633
  }
635
634
  // 设置视频窗口是否显示
636
635
  function setVideoVisible(show) {
637
- return callNative(getFuncName$3('setVideoVisible'), { visible: show });
636
+ return callNative(getFuncName$4('setVideoVisible'), { visible: show });
638
637
  }
639
638
  // 播放器,播放新的URL
640
639
  function playNewUrl(url) {
641
- return callNative(getFuncName$3('playNewUrl'), { url: url });
640
+ return callNative(getFuncName$4('playNewUrl'), { url: url });
642
641
  }
643
642
  // 播放器,播放新的本地文件路径
644
643
  function playNewFile(path) {
645
- return callNative(getFuncName$3('playNewFile'), { path: path });
644
+ return callNative(getFuncName$4('playNewFile'), { path: path });
646
645
  }
647
646
  // 播放器,停止播放
648
647
  function stop() {
649
- return callNative(getFuncName$3('stop'), null);
648
+ return callNative(getFuncName$4('stop'), null);
650
649
  }
651
650
  // 播放器,暂停播放
652
651
  function pause() {
653
- return callNative(getFuncName$3('pause'), null);
652
+ return callNative(getFuncName$4('pause'), null);
654
653
  }
655
654
  // 播放器,启动播放或者从暂停恢复播放
656
655
  function start() {
657
- return callNative(getFuncName$3('start'), null);
656
+ return callNative(getFuncName$4('start'), null);
658
657
  }
659
658
  // 播放器,seek
660
659
  function seekTo(position) {
661
- return callNative(getFuncName$3('seekTo'), { position: Math.floor(position) });
660
+ return callNative(getFuncName$4('seekTo'), { position: Math.floor(position) });
662
661
  }
663
662
  // 播放器,是否准备好
664
663
  function hasPrepared() {
665
- return callNative(getFuncName$3('hasPrepared'), null);
664
+ return callNative(getFuncName$4('hasPrepared'), null);
666
665
  }
667
666
  // 播放器,是否正在播放中
668
667
  function isPlaying() {
669
- return callNative(getFuncName$3('isPlaying'), null);
668
+ return callNative(getFuncName$4('isPlaying'), null);
670
669
  }
671
670
  // 播放器,获取总时长
672
671
  function getDuration() {
673
- return callNative(getFuncName$3('getDuration'), null);
672
+ return callNative(getFuncName$4('getDuration'), null);
674
673
  }
675
674
  // 播放器,获取当前进度值
676
675
  function getCurrentPosition() {
677
- return callNative(getFuncName$3('getCurrentPosition'), null);
676
+ return callNative(getFuncName$4('getCurrentPosition'), null);
678
677
  }
679
678
  // 播放器,获取播放状态,返回的value为字符串来标识播放状态
680
679
  // 例如:Idle, Initialized, Preparing, Prepared, Started, Paused, Stopped, Completed, Error, End
681
680
  function getPlayerState() {
682
- return callNative(getFuncName$3('getPlayerState'), null);
681
+ return callNative(getFuncName$4('getPlayerState'), null);
683
682
  }
684
683
  // 播放器,设置单片循环模式
685
684
  // isLooping: 是否循环播放
@@ -687,40 +686,40 @@ function getPlayerState() {
687
686
  // 会无感知重播,即重播时,不会调idle/ preparing/ prepared等开始播放之前的状态)
688
687
  function setLooping(isLooping, silentLoop) {
689
688
  if (silentLoop === void 0) { silentLoop = false; }
690
- return callNative(getFuncName$3('setLooping'), { isLooping: isLooping, silentLoop: silentLoop });
689
+ return callNative(getFuncName$4('setLooping'), { isLooping: isLooping, silentLoop: silentLoop });
691
690
  }
692
691
  // 播放器,设置自动屏保锁,即:开始或恢复播放->锁屏保,停止或暂停播放->释放屏保锁 默认关闭
693
692
  function setAutoWakeLock(autoWakeLock) {
694
- return callNative(getFuncName$3('setAutoWakeLock'), { autoWakeLock: autoWakeLock });
693
+ return callNative(getFuncName$4('setAutoWakeLock'), { autoWakeLock: autoWakeLock });
695
694
  }
696
695
  // 播放器,重新播放
697
696
  function rePlay() {
698
- return callNative(getFuncName$3('rePlay'), null);
697
+ return callNative(getFuncName$4('rePlay'), null);
699
698
  }
700
699
  // 播放器,设置是否自动播放,即 play ready 后音视频自动播放 默认开启
701
700
  function setPlayWhenReady(playWhenReady) {
702
701
  if (playWhenReady === void 0) { playWhenReady = true; }
703
- return callNative(getFuncName$3('setPlayWhenReady'), { playWhenReady: playWhenReady });
702
+ return callNative(getFuncName$4('setPlayWhenReady'), { playWhenReady: playWhenReady });
704
703
  }
705
704
  // 获取当前设置的播放内核, 有可能会返回 DefaultPlayer
706
705
  // 值: DefaultPlayer, MediaPlayer, SocPlayer, ExoPlayer
707
706
  function getPlayerCore() {
708
- return callNative(getFuncName$3('getPlayerCore'), null);
707
+ return callNative(getFuncName$4('getPlayerCore'), null);
709
708
  }
710
709
  // 获取实际的播放内核, 部分内核如:最佳内核,实际上是在各个内核中进行选择,不会返回 DefaultPlayer
711
710
  // 值: MediaPlayer, SocPlayer, ExoPlayer
712
711
  function getRealPlayerCore() {
713
- return callNative(getFuncName$3('getRealPlayerCore'), null);
712
+ return callNative(getFuncName$4('getRealPlayerCore'), null);
714
713
  }
715
714
  // 设置播放内核
716
715
  // 值: DefaultPlayer, MediaPlayer, SocPlayer, ExoPlayer
717
716
  function setPlayerCore(core) {
718
- return callNative(getFuncName$3('setPlayerCore'), { core: core });
717
+ return callNative(getFuncName$4('setPlayerCore'), { core: core });
719
718
  }
720
719
  // 设置渲染模式
721
720
  // 值: SurfaceView, TextureView
722
721
  function setRenderType(playerRender) {
723
- return callNative(getFuncName$3('setRenderType'), { playerRender: playerRender });
722
+ return callNative(getFuncName$4('setRenderType'), { playerRender: playerRender });
724
723
  }
725
724
  var video = {
726
725
  setVideoLayout: setVideoLayout,
@@ -746,9 +745,9 @@ var video = {
746
745
  setRenderType: setRenderType,
747
746
  };
748
747
 
749
- var moduleName$2 = 'fs';
750
- function getFuncName$2(name) {
751
- return moduleName$2 + '_' + name;
748
+ var moduleName$3 = 'fs';
749
+ function getFuncName$3(name) {
750
+ return moduleName$3 + '_' + name;
752
751
  }
753
752
  // 读取文件并返回文件的所有内容
754
753
  // 参数:
@@ -756,7 +755,7 @@ function getFuncName$2(name) {
756
755
  // base64Flag: 是否以base64编码方式返回, 如果读取文本文件,则应该设置 base64Flag = false,如果读取二进制文件,则应该设置 base64Flag = true
757
756
  function readAllContent(path, base64Flag) {
758
757
  if (base64Flag === void 0) { base64Flag = false; }
759
- return callNative(getFuncName$2('readAllContent'), { path: path, base64Flag: base64Flag });
758
+ return callNative(getFuncName$3('readAllContent'), { path: path, base64Flag: base64Flag });
760
759
  }
761
760
  // 将内容全部写入文件
762
761
  // 参数:
@@ -765,114 +764,114 @@ function readAllContent(path, base64Flag) {
765
764
  // base64Flag: 是否以base64编码方式传输content, 如果写文本文件,则应该设置 base64Flag = false,如果写入二进制文件,则应该设置 base64Flag = true
766
765
  function writeAllContent(path, content, base64Flag) {
767
766
  if (base64Flag === void 0) { base64Flag = false; }
768
- return callNative(getFuncName$2('writeAllContent'), { path: path, content: content, base64Flag: base64Flag });
767
+ return callNative(getFuncName$3('writeAllContent'), { path: path, content: content, base64Flag: base64Flag });
769
768
  }
770
769
  // 获取应用基本目录的全路径名
771
770
  function getAppBaseDir() {
772
- return callNative(getFuncName$2('getAppBaseDir'), null);
771
+ return callNative(getFuncName$3('getAppBaseDir'), null);
773
772
  }
774
773
  // 获取 Cache 目录的全路径名
775
774
  function getAppCacheDir() {
776
- return callNative(getFuncName$2('getAppCacheDir'), null);
775
+ return callNative(getFuncName$3('getAppCacheDir'), null);
777
776
  }
778
777
  // 构建一个临时文件名,返回该文件的绝对路径的全文件路径名
779
778
  // 参数:
780
779
  // fileName: 指定临时文件的基本名,如果不指定,会默认随机生成一个文件名
781
780
  function makeCacheFile(fileName) {
782
781
  if (fileName === void 0) { fileName = ''; }
783
- return callNative(getFuncName$2('makeCacheFile'), { fileName: fileName });
782
+ return callNative(getFuncName$3('makeCacheFile'), { fileName: fileName });
784
783
  }
785
784
  // 构建一个正常文件名,返回该文件的绝对路径的全文件路径名
786
785
  // 参数:
787
786
  // fileName: 指定文件的基本名,如果不指定,会默认随机生成一个文件名
788
787
  function makeNormalFile(fileName) {
789
788
  if (fileName === void 0) { fileName = ''; }
790
- return callNative(getFuncName$2('makeNormalFile'), { fileName: fileName });
789
+ return callNative(getFuncName$3('makeNormalFile'), { fileName: fileName });
791
790
  }
792
791
  // 检测一个文件或者目录是否存在
793
792
  // 参数:
794
793
  // path: 指定路径
795
794
  function exists(path) {
796
- return callNative(getFuncName$2('exists'), { path: path });
795
+ return callNative(getFuncName$3('exists'), { path: path });
797
796
  }
798
797
  // 检测一个路径是否为一个普通文件
799
798
  // 参数:
800
799
  // path: 指定路径
801
800
  function isFile(path) {
802
- return callNative(getFuncName$2('isFile'), { path: path });
801
+ return callNative(getFuncName$3('isFile'), { path: path });
803
802
  }
804
803
  // 检测一个路径是否为一个目录
805
804
  // 参数:
806
805
  // path: 指定路径
807
806
  function isDirectory(path) {
808
- return callNative(getFuncName$2('isDirectory'), { path: path });
807
+ return callNative(getFuncName$3('isDirectory'), { path: path });
809
808
  }
810
809
  // 检测一个路径表示的文件或目录 是否是隐藏的
811
810
  // 参数:
812
811
  // path: 指定路径
813
812
  function isHidden(path) {
814
- return callNative(getFuncName$2('isHidden'), { path: path });
813
+ return callNative(getFuncName$3('isHidden'), { path: path });
815
814
  }
816
815
  // 检测一个路径表示的文件或目录 是否可读
817
816
  // 参数:
818
817
  // path: 指定路径
819
818
  function canRead(path) {
820
- return callNative(getFuncName$2('canRead'), { path: path });
819
+ return callNative(getFuncName$3('canRead'), { path: path });
821
820
  }
822
821
  // 检测一个路径表示的文件或目录 是否可写
823
822
  // 参数:
824
823
  // path: 指定路径
825
824
  function canWrite(path) {
826
- return callNative(getFuncName$2('canWrite'), { path: path });
825
+ return callNative(getFuncName$3('canWrite'), { path: path });
827
826
  }
828
827
  // 检测一个路径表示的文件或目录 是否可执行
829
828
  // 参数:
830
829
  // path: 指定路径
831
830
  function canExecute(path) {
832
- return callNative(getFuncName$2('canExecute'), { path: path });
831
+ return callNative(getFuncName$3('canExecute'), { path: path });
833
832
  }
834
833
  // 检测一个路径表示的文件或目录 的最后修改的时间,返回时间戳(1970年开始的秒数)
835
834
  // 参数:
836
835
  // path: 指定路径
837
836
  function lastModified(path) {
838
- return callNative(getFuncName$2('lastModified'), { path: path });
837
+ return callNative(getFuncName$3('lastModified'), { path: path });
839
838
  }
840
839
  // 删除文件
841
840
  // 参数:
842
841
  // path: 指定路径
843
842
  function deleteIt(path) {
844
- return callNative(getFuncName$2('delete'), { path: path });
843
+ return callNative(getFuncName$3('delete'), { path: path });
845
844
  }
846
845
  // 新建目录
847
846
  // 参数:
848
847
  // path: 指定路径
849
848
  function mkdir(path) {
850
- return callNative(getFuncName$2('mkdir'), { path: path });
849
+ return callNative(getFuncName$3('mkdir'), { path: path });
851
850
  }
852
851
  // 新建目录 (如果父目录补存在则一并新建所有尚未存在的父目录)
853
852
  // 参数:
854
853
  // path: 指定路径
855
854
  function mkdirs(path) {
856
- return callNative(getFuncName$2('mkdirs'), { path: path });
855
+ return callNative(getFuncName$3('mkdirs'), { path: path });
857
856
  }
858
857
  // 改名
859
858
  // 参数:
860
859
  // from: 指定源路径
861
860
  // to: 指定目标路径
862
861
  function rename(from, to) {
863
- return callNative(getFuncName$2('rename'), { from: from, to: to });
862
+ return callNative(getFuncName$3('rename'), { from: from, to: to });
864
863
  }
865
864
  // 将相对路径的转换为全路径
866
865
  // 参数:
867
866
  // path: 指定路径
868
867
  function getAbsolutePath(path) {
869
- return callNative(getFuncName$2('getAbsolutePath'), { path: path });
868
+ return callNative(getFuncName$3('getAbsolutePath'), { path: path });
870
869
  }
871
870
  // 指定路径创建新文件
872
871
  // 参数:
873
872
  // path: 指定路径
874
873
  function createNewFile(path) {
875
- return callNative(getFuncName$2('createNewFile'), { path: path });
874
+ return callNative(getFuncName$3('createNewFile'), { path: path });
876
875
  }
877
876
  // 设置可读属性
878
877
  // 参数:
@@ -880,7 +879,7 @@ function createNewFile(path) {
880
879
  // value: 是否可读
881
880
  function setReadable(path, value) {
882
881
  if (value === void 0) { value = true; }
883
- return callNative(getFuncName$2('setReadable'), { path: path, value: value });
882
+ return callNative(getFuncName$3('setReadable'), { path: path, value: value });
884
883
  }
885
884
  // 设置可写属性
886
885
  // 参数:
@@ -888,7 +887,7 @@ function setReadable(path, value) {
888
887
  // value: 是否可写
889
888
  function setWritable(path, value) {
890
889
  if (value === void 0) { value = true; }
891
- return callNative(getFuncName$2('setWritable'), { path: path, value: value });
890
+ return callNative(getFuncName$3('setWritable'), { path: path, value: value });
892
891
  }
893
892
  // 设置可执行属性
894
893
  // 参数:
@@ -896,7 +895,7 @@ function setWritable(path, value) {
896
895
  // value: 是否可执行
897
896
  function setExecutable(path, value) {
898
897
  if (value === void 0) { value = true; }
899
- return callNative(getFuncName$2('setExecutable'), { path: path, value: value });
898
+ return callNative(getFuncName$3('setExecutable'), { path: path, value: value });
900
899
  }
901
900
  // 设置文件最后修改的时间
902
901
  // 参数:
@@ -904,13 +903,13 @@ function setExecutable(path, value) {
904
903
  // value: 时间戳
905
904
  function setLastModified(path, value) {
906
905
  if (value === void 0) { value = 0; }
907
- return callNative(getFuncName$2('setLastModified'), { path: path, value: value });
906
+ return callNative(getFuncName$3('setLastModified'), { path: path, value: value });
908
907
  }
909
908
  // 读取目录,返回该目录下的文件列表
910
909
  // 参数:
911
910
  // path: 指定路径
912
911
  function list(path) {
913
- return callNative(getFuncName$2('list'), { path: path });
912
+ return callNative(getFuncName$3('list'), { path: path });
914
913
  }
915
914
  var fs = {
916
915
  readAllContent: readAllContent,
@@ -940,19 +939,19 @@ var fs = {
940
939
  list: list
941
940
  };
942
941
 
943
- var moduleName$1 = 'pag';
944
- function getFuncName$1(name) {
945
- return moduleName$1 + '_' + name;
942
+ var moduleName$2 = 'pag';
943
+ function getFuncName$2(name) {
944
+ return moduleName$2 + '_' + name;
946
945
  }
947
946
  // 播放PAG动画
948
947
  // repeat: 循环次数 -1 表示无限
949
948
  //
950
949
  function startNewPagAni(params) {
951
- return callNative(getFuncName$1('startNewPagAni'), params);
950
+ return callNative(getFuncName$2('startNewPagAni'), params);
952
951
  }
953
952
  // 停止PAG动画,并消失
954
953
  function stopPagAni() {
955
- return callNative(getFuncName$1('stopPagAni'), null);
954
+ return callNative(getFuncName$2('stopPagAni'), null);
956
955
  }
957
956
  function setPagVisibility(visible) {
958
957
  if (visible === void 0) { visible = true; }
@@ -969,10 +968,10 @@ function setPagVisibility(visible) {
969
968
  else {
970
969
  value = visible;
971
970
  }
972
- return callNative(getFuncName$1('setPagVisibility'), { visible: value });
971
+ return callNative(getFuncName$2('setPagVisibility'), { visible: value });
973
972
  }
974
973
  function setPagXY(x, y) {
975
- return callNative(getFuncName$1('setPagXY'), { x: x, y: y });
974
+ return callNative(getFuncName$2('setPagXY'), { x: x, y: y });
976
975
  }
977
976
  // // 播报 TTS 文本语音
978
977
  // export function sendTts(text: string, ttsId: string): Promise<any> {
@@ -1015,6 +1014,58 @@ var pag = {
1015
1014
  // clearBackground,
1016
1015
  };
1017
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
+
1018
1069
  var moduleName = 'tts';
1019
1070
  function getFuncName(name) {
1020
1071
  return moduleName + '_' + name;
@@ -1085,8 +1136,10 @@ var index = {
1085
1136
  audio: audio,
1086
1137
  video: video,
1087
1138
  pag: pag,
1088
- tts: tts,
1139
+ voice: voice,
1140
+ event: event,
1089
1141
  fs: fs,
1142
+ tts: tts,
1090
1143
  isRunInAppBrowser: isRunInAppBrowser
1091
1144
  };
1092
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
@@ -91,10 +91,16 @@ declare const _default: {
91
91
  setPagVisibility: typeof import("./pag").setPagVisibility;
92
92
  setPagXY: typeof import("./pag").setPagXY;
93
93
  };
94
- tts: {
95
- stopTts: typeof import("./tts").stopTts;
96
- sendTts: typeof import("./tts").sendTts;
97
- 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;
98
104
  };
99
105
  fs: {
100
106
  readAllContent: typeof import("./file").readAllContent;
@@ -123,6 +129,11 @@ declare const _default: {
123
129
  setLastModified: typeof import("./file").setLastModified;
124
130
  list: typeof import("./file").list;
125
131
  };
132
+ tts: {
133
+ stopTts: typeof import("./tts").stopTts;
134
+ sendTts: typeof import("./tts").sendTts;
135
+ sendStreamTts: typeof import("./tts").sendStreamTts;
136
+ };
126
137
  isRunInAppBrowser: typeof isRunInAppBrowser;
127
138
  };
128
139
  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.12",
3
+ "version": "1.0.13",
4
4
  "description": "a jssdk for coocaa tv-system",
5
5
  "type": "module",
6
6
  "main": "lib/bundle.js",