GLib.idle_add

function idle_add(priority: Number(gint), function: GLib.SourceFunc): Number(guint) {
    // Gjs wrapper for g_idle_add_full()
}
  

Adds a function to be called whenever there are no higher priority events pending. If the function returns false it is automatically removed from the list of event sources and will not be called again.

This internally creates a main loop source using GLib.idle_source_new and attaches it to the main loop context using GLib.Source.prototype.attach. You can do these steps manually if you need greater control.

priority

the priority of the idle source. Typically this will be in the range between #G_PRIORITY_DEFAULT_IDLE and #G_PRIORITY_HIGH_IDLE.

function

function to call

Returns

the ID (greater than 0) of the event source.