nevella / alcina

Automatically exported from code.google.com/p/alcina
1 stars 2 forks source link

dirndl - add a subtree-broadcast event mechanism #28

Open nevella opened 1 year ago

nevella commented 1 year ago

This uses the same class registration pattern (implements xx.handler) as the bubbling event dispatch. e

It'll be mostly used to transmit information/changes across model transformation boundaries, avoiding tight coupling.

Use case: BeanEditor contains a field bindable which is transformed to FormModel.

We want to be able to disable the BeanEditor (say during rpc dispatch) - and part of the implementation has the FormModel change its rendered DOM attribute 'inert'

* BeanEditor.inert broadcasts an InteractionEnabled (t/f) message
* FormModel picks it up (receives InteractionEnabled) and modifies its inert attr

Implementation

This is somewhat similar to listening on a store change - but it's more strongly typed and lets the broadcaster determine what it's willing to publish

It's also a little similar to Java ScopedValue - Alcina LooseContext - in that it's goal is to cross layers in a (type)-safe-ish way