microtask

0.1.9 • Public • Published

Build Status

microTask - A best effort nextTick shim

Synopsis

Defers a task to aid with asynchronous processing in a single threaded environment.

microtask(task:Function, args:Array, context:Object)

Execute task on next event loop / tick

  • param Function task - the function to call
  • param Array args - array of arguments
  • param Object context - task context

Example:

   function myTask(a,b,c){
      console.log(a,b,c);
   }
   microtask(myTask,["hello","world","!"]);
   // 
   doSomethingElse();
   // ...after next event tick ... => "Hello world!"

Package Sidebar

Install

npm i microtask

Weekly Downloads

8

Version

0.1.9

License

APACHE2_0

Last publish

Collaborators

  • kaerus