Closed WebReflection closed 1 year ago
OK, this is ready to go as minor bump.
@hoodmane I am pretty happy about current state and it's worth saying the interrupt
extra option makes sense and it used only from a worker as it makes no sense from the main because the main can't ever block anything from a worker as that's async anyway.
If you do find anything problematic, worse, or not working as you'd expect, please do let me know so that I can patch/fix this version instead of the globally clashing one I've pushed yesterday, thanks!
Looks great!
This MR is both a revert and a followup of the previous one: https://github.com/WebReflection/coincident/pull/22
It is a breaking change because it removes the attached
setInterruptHandler
as that was globally shared as opposite of being related to each and everycoincident
world.API Changes
The
coincident(self | Worker, {...options})
options
argument now accepts aninterrupt
field which:{handler:function, delay?:number}
wherehandler
is the callback used every delay millisecondsdelay
is an optional number in milliseconds that default to42
when no value is found. This is the time waited before thehandler
is invoked in case the atomic operation hasn't completed already within that amount of timeinterrupt
field is not available at all, anoop
callback will be used instead, together with adelay
of42
/cc @hoodmane @antocuni