@bridgething/browser 0.11.0 → 0.12.0
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 +15 -25
- package/package.json +2 -2
- package/wasm/core-wasm.d.ts +7 -7
- package/wasm/core-wasm.js +28 -28
- package/wasm/core-wasm_bg.wasm +0 -0
- package/wasm/core-wasm_bg.wasm.d.ts +7 -7
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
|
|
4
|
-
from a web page: install and switch webapps, push
|
|
5
|
-
|
|
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
|
-
//
|
|
14
|
+
// the daemon's network gateway, over usb or the local network
|
|
17
15
|
const device = await Device.overNetwork('bridgething.local');
|
|
18
16
|
|
|
19
|
-
//
|
|
17
|
+
// a paired bluetooth peer, over Web Serial
|
|
20
18
|
const device = await Device.overSerial();
|
|
21
19
|
```
|
|
22
20
|
|
|
23
|
-
`overSerial
|
|
24
|
-
`serialAvailable()`
|
|
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
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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.
|
|
3
|
+
"version": "0.12.0",
|
|
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.
|
|
49
|
+
"@bridgething/lib": "0.12.0"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
52
|
"typescript": "^6.0.3"
|
package/wasm/core-wasm.d.ts
CHANGED
|
@@ -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
|
|
189
|
-
readonly
|
|
190
|
-
readonly
|
|
191
|
-
readonly
|
|
192
|
-
readonly
|
|
193
|
-
readonly
|
|
194
|
-
readonly
|
|
188
|
+
readonly __wasm_bindgen_func_elem_6600: (a: number, b: number, c: number, d: number) => void;
|
|
189
|
+
readonly __wasm_bindgen_func_elem_6602: (a: number, b: number, c: number, d: number) => void;
|
|
190
|
+
readonly __wasm_bindgen_func_elem_3582: (a: number, b: number, c: number) => void;
|
|
191
|
+
readonly __wasm_bindgen_func_elem_3582_2: (a: number, b: number, c: number) => void;
|
|
192
|
+
readonly __wasm_bindgen_func_elem_3582_3: (a: number, b: number, c: number) => void;
|
|
193
|
+
readonly __wasm_bindgen_func_elem_4798: (a: number, b: number) => void;
|
|
194
|
+
readonly __wasm_bindgen_func_elem_5319: (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
|
|
544
|
+
return __wasm_bindgen_func_elem_6602(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
|
-
|
|
600
|
+
__wbg_setTimeout_e568cd0fc257b420: 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:
|
|
688
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
687
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 1006, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
688
|
+
const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_6600);
|
|
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:
|
|
693
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
692
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx: 789, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
693
|
+
const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_3582);
|
|
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:
|
|
698
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
697
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Event")], shim_idx: 789, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
698
|
+
const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_3582_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:
|
|
703
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
702
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 789, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
703
|
+
const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_3582_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:
|
|
708
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
707
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 830, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
708
|
+
const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_4798);
|
|
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:
|
|
713
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
712
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 923, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
713
|
+
const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_5319);
|
|
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
|
|
746
|
-
wasm.
|
|
745
|
+
function __wasm_bindgen_func_elem_4798(arg0, arg1) {
|
|
746
|
+
wasm.__wasm_bindgen_func_elem_4798(arg0, arg1);
|
|
747
747
|
}
|
|
748
748
|
|
|
749
|
-
function
|
|
750
|
-
wasm.
|
|
749
|
+
function __wasm_bindgen_func_elem_5319(arg0, arg1) {
|
|
750
|
+
wasm.__wasm_bindgen_func_elem_5319(arg0, arg1);
|
|
751
751
|
}
|
|
752
752
|
|
|
753
|
-
function
|
|
754
|
-
wasm.
|
|
753
|
+
function __wasm_bindgen_func_elem_3582(arg0, arg1, arg2) {
|
|
754
|
+
wasm.__wasm_bindgen_func_elem_3582(arg0, arg1, addHeapObject(arg2));
|
|
755
755
|
}
|
|
756
756
|
|
|
757
|
-
function
|
|
758
|
-
wasm.
|
|
757
|
+
function __wasm_bindgen_func_elem_3582_2(arg0, arg1, arg2) {
|
|
758
|
+
wasm.__wasm_bindgen_func_elem_3582_2(arg0, arg1, addHeapObject(arg2));
|
|
759
759
|
}
|
|
760
760
|
|
|
761
|
-
function
|
|
762
|
-
wasm.
|
|
761
|
+
function __wasm_bindgen_func_elem_3582_3(arg0, arg1, arg2) {
|
|
762
|
+
wasm.__wasm_bindgen_func_elem_3582_3(arg0, arg1, addHeapObject(arg2));
|
|
763
763
|
}
|
|
764
764
|
|
|
765
|
-
function
|
|
765
|
+
function __wasm_bindgen_func_elem_6600(arg0, arg1, arg2) {
|
|
766
766
|
try {
|
|
767
767
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
768
|
-
wasm.
|
|
768
|
+
wasm.__wasm_bindgen_func_elem_6600(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
|
|
780
|
-
wasm.
|
|
779
|
+
function __wasm_bindgen_func_elem_6602(arg0, arg1, arg2, arg3) {
|
|
780
|
+
wasm.__wasm_bindgen_func_elem_6602(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
781
781
|
}
|
|
782
782
|
|
|
783
783
|
|
package/wasm/core-wasm_bg.wasm
CHANGED
|
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
|
|
30
|
-
export const
|
|
31
|
-
export const
|
|
32
|
-
export const
|
|
33
|
-
export const
|
|
34
|
-
export const
|
|
35
|
-
export const
|
|
29
|
+
export const __wasm_bindgen_func_elem_6600: (a: number, b: number, c: number, d: number) => void;
|
|
30
|
+
export const __wasm_bindgen_func_elem_6602: (a: number, b: number, c: number, d: number) => void;
|
|
31
|
+
export const __wasm_bindgen_func_elem_3582: (a: number, b: number, c: number) => void;
|
|
32
|
+
export const __wasm_bindgen_func_elem_3582_2: (a: number, b: number, c: number) => void;
|
|
33
|
+
export const __wasm_bindgen_func_elem_3582_3: (a: number, b: number, c: number) => void;
|
|
34
|
+
export const __wasm_bindgen_func_elem_4798: (a: number, b: number) => void;
|
|
35
|
+
export const __wasm_bindgen_func_elem_5319: (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;
|