nathanaelsousa / myFrame

Group your AnimationFrames by priority and stage (read, write).

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

myFrame

requestAnimationFrame with steroids. It is meant to help on progressive loading a web page, showing content to the user as soon as possible.

myFrame.onResponse(function, stage)
 Request to call a function in the response frame.
   function
     The function to be called.
   stage
     The stage which the function will be called.
     "read" | "write" defaults to "write".
     Functions in the read stage are called first so recalculate Style is not forced.

myFrame.onNext(function, stage)
 Request to call a function in the nextframe, which is the frame just after the response frame.
 Works equals requestReponse().

myFrame.onLast(function, stage)
 Request to call a function in the lastframe, which is the frame executed just after all the next frames are.
 Works equals requestReponse().

*If you request a frame in a function already running inside a frame and the requested frame was previously executed or is executing, a new frame is created and added to the stack of frames left and the stack will be consumed normally according to the priority order.

About

Group your AnimationFrames by priority and stage (read, write).


Languages

Language:JavaScript 95.3%Language:HTML 4.7%