paulmillr / chokidar

Minimal and efficient cross-platform file watching library
https://paulmillr.com
MIT License
10.99k stars 582 forks source link

Features: multiple events options for `.on()` #1249

Closed sudoaugustin closed 2 years ago

sudoaugustin commented 2 years ago

Sometimes we want to apply the same functions for different events. So I think it would be great if the on method accept multiple events

chokidar.watch("some/paths").on('change, add', () => someFunc());

(or)

chokidar.watch("some/paths").on(["change", "add"], () => someFunc());

paulmillr commented 2 years ago

Use 'all' event, or do it manually with loop