@sprucelabs/spruce-heartwood-utils 31.1.7 → 31.1.9

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.
@@ -13,6 +13,7 @@ export declare class HeartwoodDevice extends EventEmitter implements Device {
13
13
  turnTorchOff(): void;
14
14
  AudioController(mp3Url: string): Promise<AudioController>;
15
15
  openUrl(url: string): void;
16
+ isBridgedToDevice(): boolean;
16
17
  static Device(storage: Storage): HeartwoodDevice;
17
18
  setCachedValue(key: string, value: CachedValue): void;
18
19
  getCachedValue(key: string): CachedValue;
@@ -29,7 +29,7 @@ class HeartwoodDevice extends events_1.default {
29
29
  this.sendCommand('turnTorchOff');
30
30
  }
31
31
  async AudioController(mp3Url) {
32
- const audio = new HeartwoodAudioController_1.default(this);
32
+ const audio = HeartwoodAudioController_1.default.Controller(this);
33
33
  await audio.load(mp3Url);
34
34
  return audio;
35
35
  }
@@ -38,6 +38,9 @@ class HeartwoodDevice extends events_1.default {
38
38
  url,
39
39
  });
40
40
  }
41
+ isBridgedToDevice() {
42
+ return !!window.api || !!window.AndroidInterface || !!window.webkit;
43
+ }
41
44
  static Device(storage) {
42
45
  (0, schema_1.assertOptions)({ storage }, ['storage']);
43
46
  return new (this.Class ?? this)(storage);
@@ -37,6 +37,9 @@ class SpruceError extends error_1.default {
37
37
  case 'DEVICE_ERROR':
38
38
  message = 'A Device error just happened!';
39
39
  break;
40
+ case 'AUDIO_ERROR':
41
+ message = 'A Audio error just happened!';
42
+ break;
40
43
  default:
41
44
  message = super.friendlyMessage();
42
45
  }
@@ -13,6 +13,7 @@ export declare class HeartwoodDevice extends EventEmitter implements Device {
13
13
  turnTorchOff(): void;
14
14
  AudioController(mp3Url: string): Promise<AudioController>;
15
15
  openUrl(url: string): void;
16
+ isBridgedToDevice(): boolean;
16
17
  static Device(storage: Storage): HeartwoodDevice;
17
18
  setCachedValue(key: string, value: CachedValue): void;
18
19
  getCachedValue(key: string): CachedValue;
@@ -33,7 +33,7 @@ export class HeartwoodDevice extends EventEmitter {
33
33
  }
34
34
  AudioController(mp3Url) {
35
35
  return __awaiter(this, void 0, void 0, function* () {
36
- const audio = new HeartwoodAudioController(this);
36
+ const audio = HeartwoodAudioController.Controller(this);
37
37
  yield audio.load(mp3Url);
38
38
  return audio;
39
39
  });
@@ -43,6 +43,9 @@ export class HeartwoodDevice extends EventEmitter {
43
43
  url,
44
44
  });
45
45
  }
46
+ isBridgedToDevice() {
47
+ return !!window.api || !!window.AndroidInterface || !!window.webkit;
48
+ }
46
49
  static Device(storage) {
47
50
  var _a;
48
51
  assertOptions({ storage }, ['storage']);
@@ -32,6 +32,9 @@ export default class SpruceError extends AbstractSpruceError {
32
32
  case 'DEVICE_ERROR':
33
33
  message = 'A Device error just happened!';
34
34
  break;
35
+ case 'AUDIO_ERROR':
36
+ message = 'A Audio error just happened!';
37
+ break;
35
38
  default:
36
39
  message = super.friendlyMessage();
37
40
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sprucelabs/spruce-heartwood-utils",
3
3
  "description": "Heartwood Utilities",
4
- "version": "31.1.7",
4
+ "version": "31.1.9",
5
5
  "skill": {
6
6
  "namespace": "heartwood"
7
7
  },