gajus / turbowatch

Extremely fast file change detector and task orchestrator for Node.js.
Other
944 stars 23 forks source link

Replace initialRun with onStart #42

Open gajus opened 1 year ago

gajus commented 1 year ago

As reported in https://github.com/gajus/turbowatch/issues/41, the initialRun API might be a bit confusing for first-time users because it triggers onChange with an empty array. A simpler API would be to simply add onStart hook. However, there are trade-offs.

At the moment, initialRun triggers onChange, which if it fails, user could just re-run it the next time a change is detected. Adding onStart means that we need to think of how to handle onStart failing.

Open questions:

gajus commented 1 year ago

FYI @hyldmo