My old event loop helper library for Linux. Not recommended for new projects.
If you add a file to the event loop, which events are you interested in?
To add listeners for file events on a specific file dispatcher, use this. See FileEventDispatcher.addFile for the parameters
Adds a file handle to the event loop. When the handle has data available to read (if events & FileEvents.read) or write (if events & FileEvents.write), a message FileReadyToRead and/or FileReadyToWrite will be dispatched.
Adds an event listener. Event listeners must be functions that take exactly one argument.
Calls this function once every time the event system is idle
Clears a timer
Sends an exit event to the loop. The loop will break when it sees this event, ignoring any events after that point.
Runs the loop, dispatching events to registered listeners as they come in
you generally won't want to call this, but if you fork() and then try to use the thing without exec(), you might want new pipes so the events don't get mixed up.
Removes the file from event handling
Removes an event listener. Returns true if the event was actually found.
Removes an idle handler (added with addOnIdle)
Send a message to the event loop
Sends a message to the listeners immediately, bypassing the event loop
Sets a continuously firing interval. It will call the function as close to the interval as it can, but it won't let triggers stack up.
Sets a timer, one-shot by default. Count tells how many times the timer will fire. Set to zero for a continuously firing timer
This is a low level event that is dispatched when a listened file (see: addFileToLoop) has an error
Since the lowest level event for files only allows one handler, but can send events that require a variety of different responses, the FileEventDispatcher is available to make this easer.
This is a low level event that is dispatched when a listened file (see: addFileToLoop) has a hang up event
This is a low level event that is dispatched when a listened file (see: addFileToLoop) is ready to be read You should read as much as possible without blocking from the file now, as a future event may not be fired for left over data
This is a low level event that is dispatched when a listened file (see: addFileToLoop) is ready to be written to
An opaque type to reference an active timer
Valid event listeners must be callable and take exactly one argument. The type of argument determines the type of event.