diff options
author | Aylur <[email protected]> | 2024-06-15 23:33:47 +0200 |
---|---|---|
committer | Aylur <[email protected]> | 2024-06-15 23:33:47 +0200 |
commit | a4229d6db2896a9e600ec7110c0370d50f2fb73c (patch) | |
tree | d06a816b5dd76a880956262c318f13fb56874ca8 /gjs/src | |
parent | 183e68d68c3cbc264a9e94339af3ff7982acd3cc (diff) |
fix(gjs): property getter in binding
Diffstat (limited to 'gjs/src')
-rw-r--r-- | gjs/src/binding.ts | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/gjs/src/binding.ts b/gjs/src/binding.ts index 50d941d..af92e78 100644 --- a/gjs/src/binding.ts +++ b/gjs/src/binding.ts @@ -52,8 +52,13 @@ export default class Binding<Value> { if (typeof this.emitter.get === "function") return this.transformFn(this.emitter.get()) - if (typeof this.prop === "string") + if (typeof this.prop === "string") { + const getter = `get_${snakeify(this.prop)}` + if (typeof this.emitter[getter] === "function") + return this.transformFn(this.emitter[getter]()) + return this.transformFn(this.emitter[this.prop]) + } throw Error("can not get value of binding") } |