@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.
@@ -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
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "4.2.1",
2
+ "version": "4.2.2",
3
3
  "license": "MIT",
4
4
  "name": "@placeos/ts-client",
5
5
  "author": "Alex Sorafumo <alex@place.tech>",
@@ -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
  */