fix(api) bind extension api entries as facades #906
Merged
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.
Type of change
Dependencies added
Details
As of 5.0.0 our out-of-the-box functions are added to the
bud.api
container rather thanbud
itself. instead we bind a facade tobud
for each function -- this is what people call in their config files. When a function is called, likebud.entry
(any api function), it adds the method name and passed parameters tobud.api.queue
. later on this queue is iterated over and the actual functions are called.The advantage is we remove the need to worry about async operations from user configs.
bud.entry
is a great example. the actualbud.entry
function is async, but the facade we expose is synchronous. everyone wins: we don't block the thread and the user can enjoy the fluent api without worrying about awaiting promises.Extensions can bind new functions to bud with the
api
callback. these functions were still being bound directly tobud
even after we had moved all the internal config functions to use facades. it works fine until we started to have extensions which had async functions to register. I had kind of hacked a workaround on theregister
callback for those cases:This change moves that back into the extension controller
next...api-bind-facade?expand=1
#diff-3749b73842Changelog
bud
asbud.api
facades