1.2.0 • Published 7 years ago
yy-update v1.2.0
update.js
update loop API for javascript apps
Live Example with Source
https://davidfig.github.io/update/
Installation
npm install yy-update
API Reference
Functions
init(options)
must call init() before using Update
Kind: global function
Param | Type | Description |
---|---|---|
options | object | |
options.Debug | object | pass Debug from github.com/davidfig/debug |
options.count | boolean | string | show debug counts (can supply side for panel, e.g., 'topleft') |
options.percent | boolean | string | show debug percentage |
options.FPS | boolean | string | show debug FPS |
options.onLoop | function | call at end of update loop |
registerPause(pause, resume)
register functions to call after Update pauses or resumes
Kind: global function
Param | Type |
---|---|
pause | function |
resume | function |
pauseGame()
pauses all updates
Kind: global function
resumeGame()
resumes all updates
Kind: global function
add(funct, options)
adds a function to the update loop
Kind: global function
Param | Type | Default | Description |
---|---|---|---|
funct | function | ||
options | object | ||
options.time | number | 0 | in milliseconds to call this function |
options.FPS | number | this replaces options.time and calls the function at the desired FPS | |
options.once | boolean | false | call only once and then remove from update queue |
options.percent | string | name to track the percentage in the debug panel |
clear()
removes all updates and clears the percentage list
Kind: global function
remove(update)
removes an update from the loop
Kind: global function
Param | Type | Description |
---|---|---|
update | object | object returned by add() |
update()
starts the update loop
Kind: global function
Copyright (c) 2017 YOPEY YOPEY LLC - MIT License - Documented by jsdoc-to-markdown