spatial-trigger
given a spatial event emitter and an
axis aligned bounding box, return a new event
emitter that emits enter
and exit
events when spatial events indicate that something
has passed into the bounding box.
var trigger = aabb = SPEE = spee = speespeespee // 'entered box'speespeespee // 'exited box'
API
ee = trigger(spatial_ee, boundingBox[, eventName='position'])
attaches one infinite listener to spatial_ee
and one at boundingBox
for
eventName
(which defaults to 'position'
if not given), and returns an event
emitter that emits 'enter'
and 'exit'
events.
Events
enter
enter
events happen whenever the positions emitted by spatial_ee
cross into
the given bounding box. When an event triggers the enter
event, its arguments
will be forwarded to enter
listeners.
exit
exit
events happen whenever the positions emitted by spatial_ee
leave
the given bounding box. When an event triggers the exit
event, its arguments
will be forwarded to exit
listeners.
License
MIT