Skip to content

$.dynamic()

Arthur Guiot edited this page Jul 25, 2017 · 1 revision

How it works?

This function is made to dynamically update content by running again and again a function.

You can see this function as a contraption of window.setInterval() because it's almost the same thing.

How to use it?

To use it, you'll need 2 arguments:

  • callback - the function that will be runned again and again
  • push (optional) - the interval between each iteration in milliseconds. Its default value is 100.

Example

JS:

var render = {
    time: new Date().getTime()/1000,
};
var $ = new DisplayJS(render);
$.dynamic(function() {
    render.time = = new Date().getTime()/1000;
}, 1000/30); // 30 fps
$.var(true);

⚠️ Questions?

Don't hesitate to ask your questions ⁉️ in the issue part 😁

Clone this wiki locally