Class: VDomRenderer

caph.module.renderer. VDomRenderer

new VDomRenderer()

A class represents a module that renders a collection of VDom nodes, which have their own lightweight properties which correspond to the one in DOM Element. The renderer instance contains a root rendering node as its rendering context. Any object, which wants to be rendered, needs to be added to a child of root nodes. A singleton is the instance of this class, which can be accessible with its 'getInstance' method.

Since:
  • 2.0.0
Example
var VDom = caph.require('module.renderer.VDom');
var renderer = caph.require('module.renderer.VDomRenderer').getInstance();
renderer.mount(new VDom(), document.body);

(function loop(timeStamp) {
     renderer.tick(timeStamp);
     window.requestAnimationFrame(loop);
})(window.performance.now());

Methods

<static> getInstance() → {caph.module.renderer.VDomRenderer}

Returns an instance of VDomRenderer

Since:
  • 2.0.0
Returns:
Type
caph.module.renderer.VDomRenderer
Example
caph.require('module.renderer.VDomRenderer').getInstance();

tick(timeStamp)

Executes its rendering process.

Parameters:
Name Type Description
timeStamp Number

This is an elapsed time from previous tick time, which is in millisecond.

Since:
  • 2.0.0
Example
var VDom = caph.require('module.renderer.VDom');
var renderer = caph.require('module.renderer.VDomRenderer').getInstance();
renderer.mount(new VDom(), document.body);

(function loop(timeStamp) {
     renderer.tick(timeStamp);
     window.requestAnimationFrame(loop);
})(window.performance.now());