scheduling

1.3.5 • Public • Published

Scheduler

A simple javascript tool for enterframe tasks.

Installation

npm install scheduling

Usage

Adding enterframe task :

import Scheduler from 'scheduling';
let enterframeID = Scheduler.addEF(loop);

function loop() {
    ...
}

Remove enterframe task :

Scheduler.removeEF(enterframeID);

Delay call

Scheduler.delay(delayFunc, 'hello', 500);
function delayFunc(mStr) {
    console.log(mStr);  //  console output 'hello'
}

Calling in the next frame :

checkLoaded();

function checkLoaded() {
    if(!loaded) {
        Scheduler.next(checkLoaded);
        return;
    }
    
    ... //  loaded
}

Green threading

Scheduler.defer(func, [params]);

Readme

Keywords

Package Sidebar

Install

npm i scheduling

Weekly Downloads

18

Version

1.3.5

License

MIT

Unpacked Size

11.8 kB

Total Files

10

Last publish

Collaborators

  • yiwenl