Gio.PollableInputStream.prototype.create_source
function create_source(cancellable: Gio.Cancellable): GLib.Source { // Gjs wrapper for g_pollable_input_stream_create_source() }
Creates a GLib.Source that triggers when stream can be read, or cancellable is triggered or an error occurs. The callback on the source is of the Gio.PollableSourceFunc type.
As with Gio.PollableInputStream.prototype.is_readable, it is possible that the stream may not actually be readable even after the source triggers, so you should use Gio.PollableInputStream.prototype.read_nonblocking rather than Gio.InputStream.prototype.read from the callback.
Since 2.28
- cancellable
a Gio.Cancellable, or null
- Returns
a new GLib.Source