Gio.PollableOutputStream.prototype.create_source

function create_source(cancellable: Gio.Cancellable): GLib.Source {
    // Gjs wrapper for g_pollable_output_stream_create_source()
}
  

Creates a GLib.Source that triggers when stream can be written, or cancellable is triggered or an error occurs. The callback on the source is of the Gio.PollableSourceFunc type.

As with Gio.PollableOutputStream.prototype.is_writable, it is possible that the stream may not actually be writable even after the source triggers, so you should use Gio.PollableOutputStream.prototype.write_nonblocking rather than Gio.OutputStream.prototype.write from the callback.

Since 2.28

cancellable

a Gio.Cancellable, or null

Returns

a new GLib.Source