@bridgething/browser 0.11.0 → 0.12.1

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/README.md CHANGED
@@ -1,50 +1,40 @@
1
1
  # @bridgething/browser
2
2
 
3
- Drive a [bridgething](https://github.com/JoeyEamigh/bridgething) Spotify Car Thing
4
- from a web page: install and switch webapps, push daemon and image updates, rename
5
- the device.
3
+ Drive a [bridgething](https://github.com/JoeyEamigh/bridgething) Spotify Car
4
+ Thing from a web page: install and switch webapps, push updates, rename the
5
+ device.
6
6
 
7
7
  ```sh
8
8
  bun add @bridgething/browser
9
9
  ```
10
10
 
11
- ## Connecting
12
-
13
11
  ```ts
14
12
  import { Device } from '@bridgething/browser';
15
13
 
16
- // over the usb-c cable, via the daemon's network gateway
14
+ // the daemon's network gateway, over usb or the local network
17
15
  const device = await Device.overNetwork('bridgething.local');
18
16
 
19
- // or over an already-paired bluetooth peer, via Web Serial
17
+ // a paired bluetooth peer, over Web Serial
20
18
  const device = await Device.overSerial();
21
19
  ```
22
20
 
23
- `overSerial()` resolves null when the user dismisses the chooser. Use
24
- `serialAvailable()` to decide whether to offer it at all; iOS Safari and Firefox
25
- have no Web Serial.
26
-
27
- ## Driving a device
21
+ `overSerial` resolves null when the user dismisses the port chooser. Web Serial
22
+ is Chromium-only; check `serialAvailable()` before offering it.
28
23
 
29
24
  ```ts
30
- const meta = await device.meta();
31
25
  const webapps = await device.webapps();
32
-
33
26
  await device.switchWebapp(webapps[0].id);
34
- await device.installWebapp(
35
- new Uint8Array(await bundle.arrayBuffer()),
36
- catalogUrl,
37
- );
27
+ await device.installWebapp(bytes, 'https://apps.example.com/weather.zip');
38
28
  await device.setNickname('the dashboard');
39
- ```
40
29
 
41
- Updates are a push plus a feed:
42
-
43
- ```ts
44
30
  const phase = await device.push('daemon', binary);
45
31
  if (phase.kind === 'failed') console.error(phase.reason);
46
32
  ```
47
33
 
48
- Manifest helpers - `fetchManifest`, `compositeVersion`, `otaArtifactUrls` - read
49
- the same discover manifest the device does, so a page can work out what a device
50
- should be running.
34
+ `installWebapp` records the second argument as the install's source.
35
+ `nextEvent` reads the progress feed during a push. `fetchManifest`,
36
+ `compositeVersion`, and `otaArtifactUrls` read the release manifest the device
37
+ reads.
38
+
39
+ - Docs: <https://bridgething.com/docs>
40
+ - Source: <https://github.com/JoeyEamigh/bridgething>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bridgething/browser",
3
- "version": "0.11.0",
3
+ "version": "0.12.1",
4
4
  "description": "Drive a Spotify Car Thing from the browser: the bridgething delivery core compiled to wasm, plus the Web Serial and network transports.",
5
5
  "license": "MIT",
6
6
  "author": "Joey Eamigh <55670930+JoeyEamigh@users.noreply.github.com> (https://github.com/JoeyEamigh)",
@@ -46,7 +46,7 @@
46
46
  "lint": "eslint ."
47
47
  },
48
48
  "dependencies": {
49
- "@bridgething/lib": "0.11.0"
49
+ "@bridgething/lib": "0.12.1"
50
50
  },
51
51
  "peerDependencies": {
52
52
  "typescript": "^6.0.3"
@@ -185,13 +185,13 @@ export interface InitOutput {
185
185
  readonly discoverManifest: (a: number, b: number) => number;
186
186
  readonly init: () => void;
187
187
  readonly parseCompositeVersion: (a: number, b: number, c: number) => void;
188
- readonly __wasm_bindgen_func_elem_6457: (a: number, b: number, c: number, d: number) => void;
189
- readonly __wasm_bindgen_func_elem_6459: (a: number, b: number, c: number, d: number) => void;
190
- readonly __wasm_bindgen_func_elem_4191: (a: number, b: number, c: number) => void;
191
- readonly __wasm_bindgen_func_elem_4191_2: (a: number, b: number, c: number) => void;
192
- readonly __wasm_bindgen_func_elem_4191_3: (a: number, b: number, c: number) => void;
193
- readonly __wasm_bindgen_func_elem_4673: (a: number, b: number) => void;
194
- readonly __wasm_bindgen_func_elem_5178: (a: number, b: number) => void;
188
+ readonly __wasm_bindgen_func_elem_6602: (a: number, b: number, c: number, d: number) => void;
189
+ readonly __wasm_bindgen_func_elem_6604: (a: number, b: number, c: number, d: number) => void;
190
+ readonly __wasm_bindgen_func_elem_3585: (a: number, b: number, c: number) => void;
191
+ readonly __wasm_bindgen_func_elem_3585_2: (a: number, b: number, c: number) => void;
192
+ readonly __wasm_bindgen_func_elem_3585_3: (a: number, b: number, c: number) => void;
193
+ readonly __wasm_bindgen_func_elem_4800: (a: number, b: number) => void;
194
+ readonly __wasm_bindgen_func_elem_5321: (a: number, b: number) => void;
195
195
  readonly __wbindgen_export: (a: number, b: number) => number;
196
196
  readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
197
197
  readonly __wbindgen_export3: (a: number) => void;
package/wasm/core-wasm.js CHANGED
@@ -541,7 +541,7 @@ function __wbg_get_imports() {
541
541
  const a = state0.a;
542
542
  state0.a = 0;
543
543
  try {
544
- return __wasm_bindgen_func_elem_6459(a, state0.b, arg0, arg1);
544
+ return __wasm_bindgen_func_elem_6604(a, state0.b, arg0, arg1);
545
545
  } finally {
546
546
  state0.a = a;
547
547
  }
@@ -597,7 +597,7 @@ function __wbg_get_imports() {
597
597
  __wbg_send_a321b376d40ec867: function() { return handleError(function (arg0, arg1, arg2) {
598
598
  getObject(arg0).send(getArrayU8FromWasm0(arg1, arg2));
599
599
  }, arguments); },
600
- __wbg_setTimeout_3dfd69fc65d92241: function(arg0, arg1) {
600
+ __wbg_setTimeout_fa9cb36afb7c3991: function(arg0, arg1) {
601
601
  setTimeout(getObject(arg0), arg1);
602
602
  },
603
603
  __wbg_set_0de9c62c23d04ad5: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
@@ -684,33 +684,33 @@ function __wbg_get_imports() {
684
684
  return addHeapObject(ret);
685
685
  },
686
686
  __wbindgen_cast_0000000000000001: function(arg0, arg1) {
687
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 989, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
688
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_6457);
687
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 1009, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
688
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_6602);
689
689
  return addHeapObject(ret);
690
690
  },
691
691
  __wbindgen_cast_0000000000000002: function(arg0, arg1) {
692
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx: 808, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
693
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_4191);
692
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx: 792, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
693
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_3585);
694
694
  return addHeapObject(ret);
695
695
  },
696
696
  __wbindgen_cast_0000000000000003: function(arg0, arg1) {
697
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Event")], shim_idx: 808, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
698
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_4191_2);
697
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Event")], shim_idx: 792, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
698
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_3585_2);
699
699
  return addHeapObject(ret);
700
700
  },
701
701
  __wbindgen_cast_0000000000000004: function(arg0, arg1) {
702
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 808, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
703
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_4191_3);
702
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 792, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
703
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_3585_3);
704
704
  return addHeapObject(ret);
705
705
  },
706
706
  __wbindgen_cast_0000000000000005: function(arg0, arg1) {
707
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 818, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
708
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_4673);
707
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 833, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
708
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_4800);
709
709
  return addHeapObject(ret);
710
710
  },
711
711
  __wbindgen_cast_0000000000000006: function(arg0, arg1) {
712
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 906, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
713
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_5178);
712
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 926, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
713
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_5321);
714
714
  return addHeapObject(ret);
715
715
  },
716
716
  __wbindgen_cast_0000000000000007: function(arg0) {
@@ -742,30 +742,30 @@ function __wbg_get_imports() {
742
742
  };
743
743
  }
744
744
 
745
- function __wasm_bindgen_func_elem_4673(arg0, arg1) {
746
- wasm.__wasm_bindgen_func_elem_4673(arg0, arg1);
745
+ function __wasm_bindgen_func_elem_4800(arg0, arg1) {
746
+ wasm.__wasm_bindgen_func_elem_4800(arg0, arg1);
747
747
  }
748
748
 
749
- function __wasm_bindgen_func_elem_5178(arg0, arg1) {
750
- wasm.__wasm_bindgen_func_elem_5178(arg0, arg1);
749
+ function __wasm_bindgen_func_elem_5321(arg0, arg1) {
750
+ wasm.__wasm_bindgen_func_elem_5321(arg0, arg1);
751
751
  }
752
752
 
753
- function __wasm_bindgen_func_elem_4191(arg0, arg1, arg2) {
754
- wasm.__wasm_bindgen_func_elem_4191(arg0, arg1, addHeapObject(arg2));
753
+ function __wasm_bindgen_func_elem_3585(arg0, arg1, arg2) {
754
+ wasm.__wasm_bindgen_func_elem_3585(arg0, arg1, addHeapObject(arg2));
755
755
  }
756
756
 
757
- function __wasm_bindgen_func_elem_4191_2(arg0, arg1, arg2) {
758
- wasm.__wasm_bindgen_func_elem_4191_2(arg0, arg1, addHeapObject(arg2));
757
+ function __wasm_bindgen_func_elem_3585_2(arg0, arg1, arg2) {
758
+ wasm.__wasm_bindgen_func_elem_3585_2(arg0, arg1, addHeapObject(arg2));
759
759
  }
760
760
 
761
- function __wasm_bindgen_func_elem_4191_3(arg0, arg1, arg2) {
762
- wasm.__wasm_bindgen_func_elem_4191_3(arg0, arg1, addHeapObject(arg2));
761
+ function __wasm_bindgen_func_elem_3585_3(arg0, arg1, arg2) {
762
+ wasm.__wasm_bindgen_func_elem_3585_3(arg0, arg1, addHeapObject(arg2));
763
763
  }
764
764
 
765
- function __wasm_bindgen_func_elem_6457(arg0, arg1, arg2) {
765
+ function __wasm_bindgen_func_elem_6602(arg0, arg1, arg2) {
766
766
  try {
767
767
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
768
- wasm.__wasm_bindgen_func_elem_6457(retptr, arg0, arg1, addHeapObject(arg2));
768
+ wasm.__wasm_bindgen_func_elem_6602(retptr, arg0, arg1, addHeapObject(arg2));
769
769
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
770
770
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
771
771
  if (r1) {
@@ -776,8 +776,8 @@ function __wasm_bindgen_func_elem_6457(arg0, arg1, arg2) {
776
776
  }
777
777
  }
778
778
 
779
- function __wasm_bindgen_func_elem_6459(arg0, arg1, arg2, arg3) {
780
- wasm.__wasm_bindgen_func_elem_6459(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
779
+ function __wasm_bindgen_func_elem_6604(arg0, arg1, arg2, arg3) {
780
+ wasm.__wasm_bindgen_func_elem_6604(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
781
781
  }
782
782
 
783
783
 
Binary file
@@ -26,13 +26,13 @@ export const deliverysession_webapps: (a: number) => number;
26
26
  export const discoverManifest: (a: number, b: number) => number;
27
27
  export const init: () => void;
28
28
  export const parseCompositeVersion: (a: number, b: number, c: number) => void;
29
- export const __wasm_bindgen_func_elem_6457: (a: number, b: number, c: number, d: number) => void;
30
- export const __wasm_bindgen_func_elem_6459: (a: number, b: number, c: number, d: number) => void;
31
- export const __wasm_bindgen_func_elem_4191: (a: number, b: number, c: number) => void;
32
- export const __wasm_bindgen_func_elem_4191_2: (a: number, b: number, c: number) => void;
33
- export const __wasm_bindgen_func_elem_4191_3: (a: number, b: number, c: number) => void;
34
- export const __wasm_bindgen_func_elem_4673: (a: number, b: number) => void;
35
- export const __wasm_bindgen_func_elem_5178: (a: number, b: number) => void;
29
+ export const __wasm_bindgen_func_elem_6602: (a: number, b: number, c: number, d: number) => void;
30
+ export const __wasm_bindgen_func_elem_6604: (a: number, b: number, c: number, d: number) => void;
31
+ export const __wasm_bindgen_func_elem_3585: (a: number, b: number, c: number) => void;
32
+ export const __wasm_bindgen_func_elem_3585_2: (a: number, b: number, c: number) => void;
33
+ export const __wasm_bindgen_func_elem_3585_3: (a: number, b: number, c: number) => void;
34
+ export const __wasm_bindgen_func_elem_4800: (a: number, b: number) => void;
35
+ export const __wasm_bindgen_func_elem_5321: (a: number, b: number) => void;
36
36
  export const __wbindgen_export: (a: number, b: number) => number;
37
37
  export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
38
38
  export const __wbindgen_export3: (a: number) => void;