Schedulers

Creating a synchronous task

scheduler.sync(owner, () => { //This will run one tick after it is queued
  //Do something on the main thread
});

Creating a repeating synchronous task

scheduler.syncRepeating(owner, () => {
  //Do something that repeats
}, 1000, 1000); 
//Time in millis for how over it should repeat

Remember that a tick is 50 milliseconds

Creating a asynchronous task

scheduler.async(owner, () => {
  //Do something that runs on a seperate thread
});

Creating a repeating asynchronous task

scheduler.asyncRepeating(owner, () => {
  //Do something that repeats on a seperate thread
}, 1000, 1000);

Last updated