Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Mainloop applet

Use a mainloop to do things on a schedule.

// import mainloop
const Mainloop = imports.mainloop;

function doSomething() {
    // ...
    return true; // keeps the mainloop alive
}

// creation.
let id = Mainloop.timeout_add(UPDATE_INTERVAL_SEC, doSomething);
let id = Mainloop.timeout_add_seconds(UPDATE_INTERVAL_MS, doSomething);

// be sure to cleanup the timeout when you're done
Mainloop.source_remove(id);

Resources