-
Notifications
You must be signed in to change notification settings - Fork 399
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do something with hook results #47
Comments
You could use a |
@oofloren how would that work? There is no way to iterate hook subscribers, is there? |
Sorry, the notification got lost! let result
do {
result = hook.call(…)
} while (result.foo) We use a similar technique in webpack: |
No, that calls all subscribers. The idea is to stop after the first subscriber that returns something specific. is that what |
I think all |
So there is no way to achieve this without extending the public API?
…On Tue, Mar 20, 2018 at 5:09 PM Florent Cailhol ***@***.***> wrote:
I think all call* methods are private APIs. They are designed to be
called by the code factory. Not user-land code.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#47 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AADWlvABIV0pGkH90evPktrHcHpsYSFKks5tgSmggaJpZM4R5Mur>
.
|
The |
@sokra but that still doesn't allow checking for a specific value, and there's no way to wrap the hooks… |
@wmertens you can use bail hook if the the value is just what you need, just return it. |
@moonyaph that would require wrapping all the subscribers to a hook and there's no way to do that. |
@wmertens Hi! Did you manage to find a solution to this issue? |
@Telokis I ended up rewriting it with a similar API but without all the browser optimizations. https://github.com/StratoKit/strato-runner/blob/new-new-config/packages/launcher/src/tapable.js |
In my app, I would like to return early if one of the hooks returns some specific value. Would that be possible?
So for example
hook.callUntil({args: [...], condition: result => result.foo})
.The text was updated successfully, but these errors were encountered: