GLib.Source.prototype.attach

function attach(context: GLib.MainContext): Number(guint) {
    // Gjs wrapper for g_source_attach()
}
  

Adds a GLib.Source to a context so that it will be executed within that context. Remove it by calling GLib.Source.prototype.destroy.

context

a GLib.MainContext (if null, the default context will be used)

Returns

the ID (greater than 0) for the source within the GLib.MainContext.