request for info about some "spec" parameters of connections

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

request for info about some "spec" parameters of connections

Davide Della Casa
Looking at this, spec for connections:

                 + 'spec can be: {\n'
                 + '  removeAfterUpdate: Boolean,\n'
                 + '  forceAttributeConnection: Boolean,\n'
                 + '  converter: Function,\n'
                 + '  updater: Function,\n'
                 + '  varMapping: Object\n'
                 + '}',

converter and updater are explained in a couple of docs, that’s cool.

Any insight/organic explanation about what the others (removeAfterUpdate, forceAttributeConnection, varMapping) do and in which context they are necessary/useful? Online somewhere, papers anywhere, previous email threads?

If not, can anybody give a sketch in this thread?

Cheers!
Davide Della Casa
_______________________________________________
lively-kernel mailing list
[hidden email]
http://lists.hpi.uni-potsdam.de/listinfo/lively-kernel
Reply | Threaded
Open this post in threaded view
|

Re: request for info about some "spec" parameters of connections

Marko Röder
Hi Davide -

Those attributes work as follows:

removeAfterUpdate: If you set this to true, the connection will be removed after it was called one time (one-time connection).
forceAttributeConnection: If this is set to true, executing a method that is the connection source will not trigger the target to update but changing the source attribute to a different value/function will (example: see lively.bindings.tests.BindingTests.ConnectionTest -> test42ForceAttributeConnection and play with the forceAttributeConnection flag).
varMapping: Additional variables/values you want to have access to in the updater and converter function. Usually, there is "source" and "target" mapped into the scope of those functions.

Some things may be hard to discover within the code but everything is open and accessible ;-). A lot of the times, test cases also help with APIs and features.

I hope this helps,

        - Marko



On 16 Sep 2014, at 08:33, Davide Della Casa <[hidden email]> wrote:

> Looking at this, spec for connections:
>
>                 + 'spec can be: {\n'
>                 + '  removeAfterUpdate: Boolean,\n'
>                 + '  forceAttributeConnection: Boolean,\n'
>                 + '  converter: Function,\n'
>                 + '  updater: Function,\n'
>                 + '  varMapping: Object\n'
>                 + '}',
>
> converter and updater are explained in a couple of docs, that’s cool.
>
> Any insight/organic explanation about what the others (removeAfterUpdate, forceAttributeConnection, varMapping) do and in which context they are necessary/useful? Online somewhere, papers anywhere, previous email threads?
>
> If not, can anybody give a sketch in this thread?
>
> Cheers!
> Davide Della Casa
> _______________________________________________
> lively-kernel mailing list
> [hidden email]
> http://lists.hpi.uni-potsdam.de/listinfo/lively-kernel

_______________________________________________
lively-kernel mailing list
[hidden email]
http://lists.hpi.uni-potsdam.de/listinfo/lively-kernel
Reply | Threaded
Open this post in threaded view
|

Re: request for info about some "spec" parameters of connections

Robert Krahn-4
In reply to this post by Davide Della Casa
The varMapping aspect might need some explanation: With plain JS it is not possible to capture the internal state of functions (closures, closed values). The data bindings, as well as scripts you attach to objects, however, should be serializable. This means we need to capture this state somehow. When you want  converters / updaters / scripts to be real closures you can use the "varMapping" option to pass in values from the outside. The underlaying mechanism is implemented in the lively.Closure class: $world.browseCode("lively.Closure", null, "lively.lang.Closure");

On Tue, Sep 16, 2014 at 8:33 AM, Davide Della Casa <[hidden email]> wrote:
Looking at this, spec for connections:

                 + 'spec can be: {\n'
                 + '  removeAfterUpdate: Boolean,\n'
                 + '  forceAttributeConnection: Boolean,\n'
                 + '  converter: Function,\n'
                 + '  updater: Function,\n'
                 + '  varMapping: Object\n'
                 + '}',

converter and updater are explained in a couple of docs, that’s cool.

Any insight/organic explanation about what the others (removeAfterUpdate, forceAttributeConnection, varMapping) do and in which context they are necessary/useful? Online somewhere, papers anywhere, previous email threads?

If not, can anybody give a sketch in this thread?

Cheers!
Davide Della Casa
_______________________________________________
lively-kernel mailing list
[hidden email]
http://lists.hpi.uni-potsdam.de/listinfo/lively-kernel


_______________________________________________
lively-kernel mailing list
[hidden email]
http://lists.hpi.uni-potsdam.de/listinfo/lively-kernel