-
I read the entire documentation, so it might have gone over my head, but the pages for |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
both of them return an instance of Binding which is basically a struct that holds
it is possible to chain this all of this mess to have typesafety through using generics, so we can do Widget({
prop: object.bind('prop').transform(prop => prop)
}) instead of the basic imperative gobject way function transform(prop) {
return `transformed: ${prop}`
}
const widget = Widget({
prop: transform(object.prop)
})
const id = object.connect('notify::prop', () => {
widget.prop = transform(object.prop)
})
widget.connect('destroy', () => {
object.disconnect(id)
}) |
Beta Was this translation helpful? Give feedback.
both of them return an instance of Binding which is basically a struct that holds
emitter
object that needs to be watchedtransformFn
which is not meant to be called, only set, is a function that the value will go through and be set on a widget propertyBinding
with an updatedtransfromFn
it is possible to chain
transform
s since they will be composed, I think they are called composite functions in maththis
Binding
struct is only used in Widget constructors. the above mentioned three propertiesemitter
,prop
,transformFn
will be "consumed" and be translated into Widget.bind calls which are just again translat…