@cpzxrobot/sdk 1.2.91 → 1.2.92

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/dist/index.js CHANGED
@@ -69,6 +69,7 @@ class Cpzxrobot {
69
69
  this.ai = new ai_gateway_1.AiGateway(this);
70
70
  this.construction = new construction_gateway_1.ConstructionGateway(this);
71
71
  this.system = new system_gateway_1.SystemGateway(this);
72
+ this.sseCallbacks = {};
72
73
  //获取当前浏览器的域名
73
74
  this.ready = new Promise((resolve, reject) => {
74
75
  this.resolveReady = resolve;
@@ -412,9 +413,9 @@ class Cpzxrobot {
412
413
  return platform.callHandler("axios_upload", url, option);
413
414
  },
414
415
  getAsSse: async function (url, fn, config) {
415
- console.log("getAsSse", url, fn);
416
416
  var randomId = Math.random().toString(36).substring(2);
417
417
  that.sseCallbacks[randomId] = fn;
418
+ console.log("getAsSse", url, fn, randomId);
418
419
  await platform.callHandler("axios_getAsSse", url, config, randomId);
419
420
  delete that.sseCallbacks[randomId];
420
421
  },
package/index.ts CHANGED
@@ -79,7 +79,9 @@ export class Cpzxrobot {
79
79
  ai: AiGateway = new AiGateway(this);
80
80
  construction: ConstructionGateway = new ConstructionGateway(this);
81
81
  system: SystemGateway = new SystemGateway(this);
82
- sseCallbacks: any;
82
+ sseCallbacks: {
83
+ [key: string]: (data: any) => void;
84
+ } = {};
83
85
 
84
86
 
85
87
  constructor(appCode: string) {
@@ -446,14 +448,14 @@ export class Cpzxrobot {
446
448
  config.preview = true;
447
449
  }
448
450
  return platform.callHandler("axios_getAndSave", url, config);
449
- },
451
+ },
450
452
  upload: function (url, option) {
451
453
  return platform.callHandler("axios_upload", url, option);
452
454
  },
453
455
  getAsSse: async function (url, fn, config?) {
454
- console.log("getAsSse", url, fn);
455
456
  var randomId = Math.random().toString(36).substring(2);
456
457
  that.sseCallbacks[randomId] = fn;
458
+ console.log("getAsSse", url, fn, randomId);
457
459
  await platform.callHandler("axios_getAsSse", url, config, randomId);
458
460
  delete that.sseCallbacks[randomId];
459
461
  },
@@ -465,7 +467,7 @@ export class Cpzxrobot {
465
467
  window.flutter_inappwebview.callHandler != null
466
468
  ) {
467
469
  this.platformReady = Promise.resolve(true);
468
- } else {
470
+ } else {
469
471
  this.platformReady = new Promise<boolean>((resolve, reject) => {
470
472
  window.addEventListener(
471
473
  "flutterInAppWebViewPlatformReady",
@@ -492,10 +494,10 @@ export class Cpzxrobot {
492
494
  }
493
495
  };
494
496
  }
495
- }else{
497
+ } else {
496
498
  console.log("message", event);
497
499
  }
498
-
500
+
499
501
  }, false);
500
502
  } else {
501
503
  if (this.isLocalDomain(domain)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cpzxrobot/sdk",
3
- "version": "1.2.91",
3
+ "version": "1.2.92",
4
4
  "description": "提供给上海正芯数智APP第三方H5应用使用的SDK",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {