Add support for binding callback function pipelines#50
Add support for binding callback function pipelines#50MelanTech wants to merge 1 commit intoHotariTobu:mainfrom
Conversation
There was a problem hiding this comment.
[SHOULD]
Change with_pipeline to callback_pipeline.
[SHOULD]
From the perspective of a with user, it's not clear from the code whether a callback function registered with with is called when the source changes or when the target changes.
Make it possible to specify whether the callback function is called on source changes or target changes when it is registered.
For example:
func with(callback: Callback, on_source_changed: bool = false):[MUST]
Write tests.
[MUST]
Change the branch name to feat/MelanTech-callback-pipeline.
You'll need to recreate the PR to change the merge source branch name. Please finish your revisions and then create a new pull request.
| converter_pipeline: BindingConverterPipeline, | ||
| target_value_change_signal | ||
| target_value_change_signal, | ||
| with_pipeline: BindingWithPipeline = null, |
There was a problem hiding this comment.
[SHOULD]
Do not pass null as a default value, just as you would with other arguments.
| with_pipeline: BindingWithPipeline = null, | |
| with_pipeline: BindingWithPipeline, |
|
|
||
| for with_func in _with_pipeline.get_pipeline(): | ||
| assert(with_func.is_valid(), "The with function must be a valid Callable.") | ||
| with_func.call(_source_property, next_source_value) |
There was a problem hiding this comment.
[SHOULD]
Since source_property is known when the callback function is registered, passing it during the callback is redundant.
Instead, pass the value before the change.
| with_func.call(_source_property, next_source_value) | |
| with_func.call(source_value, next_source_value) |
|
Thank you for contributing to this add-on. |
Here's a prototype implementation of callback function binding, which allows for functions to be triggered after data updates. Users can bind multiple custom callback functions using the
withstatement. This functionality is particularly useful for data storage, as users can save data via callback functions once it has been updated. Below is an example of its usage: