Giter Club home page Giter Club logo

Comments (12)

ooflorent avatar ooflorent commented on July 16, 2024

You could use a do/while loop for that.

from tapable.

wmertens avatar wmertens commented on July 16, 2024

@oofloren how would that work? There is no way to iterate hook subscribers, is there?

from tapable.

ooflorent avatar ooflorent commented on July 16, 2024

Sorry, the notification got lost!

let result
do {
  result = hook.call()
} while (result.foo)

We use a similar technique in webpack:

https://github.com/webpack/webpack/blob/3024078e1e8ec3df00020acad2e2de8b199b27fc/lib/Compilation.js#L828-L834

from tapable.

wmertens avatar wmertens commented on July 16, 2024

No, that calls all subscribers. The idea is to stop after the first subscriber that returns something specific.

is that what callTapsSeries does, can that be called directly?

from tapable.

ooflorent avatar ooflorent commented on July 16, 2024

I think all call* methods are private APIs. They are designed to be called by the code factories. Not user-land code.

from tapable.

wmertens avatar wmertens commented on July 16, 2024

from tapable.

sokra avatar sokra commented on July 16, 2024

The idea is to stop after the first subscriber that returns something specific.

The Bail hooks stop after the first plugin that returns something.

from tapable.

wmertens avatar wmertens commented on July 16, 2024

@sokra but that still doesn't allow checking for a specific value, and there's no way to wrap the hooks…

from tapable.

kisoua avatar kisoua commented on July 16, 2024

@wmertens you can use bail hook if the the value is just what you need, just return it.

from tapable.

wmertens avatar wmertens commented on July 16, 2024

@moonyaph that would require wrapping all the subscribers to a hook and there's no way to do that.

from tapable.

Telokis avatar Telokis commented on July 16, 2024

@wmertens Hi!

Did you manage to find a solution to this issue?
I'd like to do the same thing, as well.

from tapable.

wmertens avatar wmertens commented on July 16, 2024

@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

from tapable.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.