Closed Profpatsch closed 3 years ago
Sure, I'll add a line to the docs about the third argument when I get a minute. Changing the type would be a good idea next time we're making a breaking API change.
I was quite confused when I read that, +1 to having it in the type. What are the semantics of Unknown
supposed to be?
Unknown
serves as an escape hatch for telling the client about events that the library doesn't understand/handle properly, rather than just dropping them on the floor as it has in the past.
Currently it can only be emitted by the Linux file watcher in response to some of the less common inotify events.
Once the library handles these events properly Unknown
will hopefully be removed.
What is the Bool for?
Edit: Ah... just what I was looking for and about to create a bug for. Is it a directory, True or False.
Re-read again and saw:
I’d argue the API should be changed to be type-documenting, by using FileType = Directory | File instead of Bool (boolean blindness).
This is fixed in master
branch and will be released in 0.4.0.0
Each
Event
constructor has gained a third argument. ForAdded
,Modified
andRemoved
, that is aBool
indicating whether it is a file or a folder as far as I can see. TheString
inUnknown
I have not yet looked up the meaning of.I’d argue the API should be changed to be type-documenting, by using
FileType = Directory | File
instead ofBool
(boolean blindness).