@placeos/ts-client 4.2.1 → 4.2.2
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.cjs.js +2 -2
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +134 -126
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/realtime/status-variable.d.ts +1 -0
- package/package.json +1 -1
- package/src/realtime/status-variable.ts +9 -0
|
@@ -25,6 +25,7 @@ export declare class PlaceVariableBinding<T = any> {
|
|
|
25
25
|
* @param next Callback for changes to the bindings value
|
|
26
26
|
*/
|
|
27
27
|
subscribe(next: (value: T) => void): Subscription;
|
|
28
|
+
bindThenSubscribe(next: (value: T) => void): Subscription;
|
|
28
29
|
/**
|
|
29
30
|
* Bind to the status variable's value
|
|
30
31
|
*/
|
package/package.json
CHANGED
|
@@ -80,6 +80,15 @@ export class PlaceVariableBinding<T = any> {
|
|
|
80
80
|
return this.listen().subscribe(next);
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
+
public bindThenSubscribe(next: (value: T) => void): Subscription {
|
|
84
|
+
const unbind = this.bind();
|
|
85
|
+
return this.listen().subscribe({
|
|
86
|
+
next,
|
|
87
|
+
complete: () => unbind(),
|
|
88
|
+
error: () => unbind(),
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
|
|
83
92
|
/**
|
|
84
93
|
* Bind to the status variable's value
|
|
85
94
|
*/
|