Refactor of the Control API and view mixin #432

merged 5 commits into from Feb 21, 2014


None yet

2 participants

DBHi member

See 9fd08a9 commit for details.

bruth added some commits Feb 21, 2014
@bruth bruth Port cilantro.utils to JavaScript 8af6373
@bruth bruth Ensure chart renders below the field form controls
This was the previous behavior, but had been changed in 537d61e by
@bruth bruth Refactor of the Control API and view mixin
Previously the control took a ContextNodeModel instance and could
freely manipulate it. However this led to inconsistent data if the
control failed to set/get certain properties. Furthermore, exposing the
context object to the control directly created a hard dependency between
the context and control APIs.

This refactor removes exposure of the context to the control view. It is
no longer passed as an option to the control during initialization. The
interaction between the control and the context solely works with
bi-directional 'change' events.

To facilitate setting the initial state of the control, controls now
support the `wait`, `ready`, and `when` methods. For asynchronous
operations that *must* complete prior to the initial state being set, the
control can call `wait()` on itself followed by `ready()` when it is
ready to receive the initial state of the context.

Likewise, dependents of controls that require it's initial state to be set
can call `when` on the control which returns a promise object that will be
resolved or rejected at a later time.

Third-party controls should be update to remove the call to `bindContext`
and make use of the `wait` and `ready` methods when working with async

Fix #415
@bruth bruth Remove mixin in favor of ControlCompositeView class 1c5c327
@bruth bruth Remove local reference of barsControl in favor of the bound reference dd6d755
@naegelyd naegelyd merged commit b6fa9b8 into 2.2 Feb 21, 2014
@naegelyd naegelyd deleted the issue-415 branch Feb 21, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment