Experimental @bind support [Discussion] #31
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR implements a first draft of a potential built-in data-binding bridge for Domkit components, as mentioned in: #20
EDIT:
I updated the the implementation to do only the following:
@bind
domkit.Macro.bindVar()
macro call. This is done in order to delay replacement to the stage, where full type information is available.__onVarChanged
)bindVar
to a dynamic functionprocessBind
for user land to implement.Users will have to implement
domkit.Macro.processBind
and pass back an expression doing the actual data-binding logic. This logic calls__onVarChanged()
in order to trigger a re-evaluation of the entire attribute expression and have the new value be assigned to the component's property.Pros
@bind
expressions and trigger a re-assignment. This is more in-line with common event driven data-models. Unlike per-expression based registration/callbacks asregisterCheckRebuild
does.Please feel free to make suggestions.