🔧 chore(app): use new createSubscription() with secureBaseBinding() to notify brightness on-screen display
This commit is contained in:
@@ -246,7 +246,7 @@ export function construct<Class extends object>(klass: Class, props: Record<any,
|
||||
|
||||
/** open connections to gobjects that are closed when the scope
|
||||
* is disposed
|
||||
* @experimental
|
||||
* @experimental types don't work correctly yet
|
||||
* */
|
||||
export function createConnetions<
|
||||
GObj extends GObject.Object,
|
||||
@@ -277,6 +277,13 @@ export function createConnetions<
|
||||
});
|
||||
}
|
||||
|
||||
export function createSubscription<T = any>(accessor: Accessor<T>, callback: () => void): void {
|
||||
const scope = getScope();
|
||||
const unsub = accessor.subscribe(callback);
|
||||
|
||||
scope.onCleanup(unsub);
|
||||
}
|
||||
|
||||
export function secureBinding<
|
||||
GObj extends GObject.Object,
|
||||
Prop extends keyof GObj,
|
||||
|
||||
Reference in New Issue
Block a user