GLib.io_create_watch
function io_create_watch(channel: GLib.IOChannel, condition: GLib.IOCondition): GLib.Source { // Gjs wrapper for g_io_create_watch() }
Creates a GLib.Source that's dispatched when condition is met for the given channel. For example, if condition is #G_IO_IN, the source will be dispatched when there's data available for reading.
GLib.io_add_watch is a simpler interface to this same functionality, for the case where you want to add the source to the default main loop context at the default priority.
On Windows, polling a GLib.Source created to watch a channel for a socket puts the socket in non-blocking mode. This is a side-effect of the implementation and unavoidable.
- channel
a GLib.IOChannel to watch
- condition
conditions to watch for
- Returns
a new GLib.Source