From 1c9377ec696c1f8269bf30a7af1e4a9566d55625 Mon Sep 17 00:00:00 2001 From: Aylur Date: Sat, 20 Jul 2024 14:05:47 +0200 Subject: update eslint, ts-for-gir --- gjs/src/variable.ts | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'gjs/src/variable.ts') diff --git a/gjs/src/variable.ts b/gjs/src/variable.ts index b5f186b..05e142f 100644 --- a/gjs/src/variable.ts +++ b/gjs/src/variable.ts @@ -22,7 +22,7 @@ class VariableWrapper extends Function { constructor(init: T) { super() this._value = init - this.variable = new Astal.VariableBase + this.variable = new Astal.VariableBase() this.variable.connect("dropped", () => { this.stopWatch() this.stopPoll() @@ -60,11 +60,13 @@ class VariableWrapper extends Function { if (v instanceof Promise) { v.then(v => this.set(v)) .catch(err => this.variable.emit("error", err)) - } else { + } + else { this.set(v) } }) - } else if (this.pollExec) { + } + else if (this.pollExec) { this._poll = interval(this.pollInterval, () => { execAsync(this.pollExec!) .then(v => this.set(this.pollTransform!(v, this.get()))) @@ -142,7 +144,8 @@ class VariableWrapper extends Function { if (typeof exec === "function") { this.pollFn = exec delete this.pollExec - } else { + } + else { this.pollExec = exec delete this.pollFn } @@ -183,7 +186,8 @@ class VariableWrapper extends Function { const [o, s] = obj o.connect(s, set) } - } else { + } + else { if (typeof sigOrFn === "string") objs.connect(sigOrFn, set) } @@ -195,7 +199,7 @@ class VariableWrapper extends Function { const Deps extends Array | Binding>, Args extends { [K in keyof Deps]: Deps[K] extends Variable - ? T : Deps[K] extends Binding ? T : never + ? T : Deps[K] extends Binding ? T : never }, >(deps: Deps, fn: (...args: Args) => V) { const update = () => fn(...deps.map(d => d.get()) as Args) @@ -216,7 +220,7 @@ export const Variable = new Proxy(VariableWrapper as any, { }) as { derive: typeof VariableWrapper["derive"] (init: T): Variable - new (init: T): Variable + new(init: T): Variable } export default Variable -- cgit v1.2.3