Definitions

SVG plot definitions.

Usage

var Defs = require( '@stdlib/plot/components/svg/defs' );

Defs()

Returns a Defs instance.

var node = new Defs();
// returns <Defs>

Methods

Defs.prototype.render()

Renders an instance as a virtual DOM tree.

var node = new Defs();

var vtree = node.render();
/* e.g., returns
    {
        'tagName': 'defs',
        'properties': {
            'namespace': void 0
        },
        'children': [],
        'namespace': 'http://www.w3.org/2000/svg',
        'count': 0,
        'hasWidgets': false,
        'hasThunks': false,
        'descendantHooks': false,
        'hooks': void 0,
        'key': void 0
    }
*/

Events

'render'

Event emitted when an instance renders. The event object is the rendered Virtual DOM tree.

var node = new Defs();

function onRender( vtree ) {
    console.log( vtree );
}

node.on( 'render', onRender );
node.render();

Listeners

'change'

Upon receiving a 'change' event, an instance re-renders.

var node = new Defs();

function onRender( vtree ) {
    console.log( vtree );
}

node.on( 'render', onRender );
node.emit( 'change' );

Examples

var toHTML = require( 'vdom-to-html' );
var defs = require( '@stdlib/plot/components/svg/defs' );

// Create a new component:
var node = defs();

// Render as a virtual DOM tree:
var vtree = node.render();

// Transform the virtual DOM tree to HTML:
var html = toHTML( vtree );
// returns <defs></defs>