Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor(graph, container, settings) {
super();
settings = settings || {};
this.settings = assign({}, DEFAULT_SETTINGS, settings);
// Validating
if (!isGraph(graph))
throw new Error('sigma/renderers/webgl: invalid graph instance.');
if (!(container instanceof HTMLElement))
throw new Error('sigma/renderers/webgl: container should be an html element.');
// Properties
this.graph = graph;
this.captors = {};
this.container = container;
this.elements = {};
this.contexts = {};
this.listeners = {};
// Indices & cache
// TODO: this could be improved by key => index => floatArray
// TODO: the cache should erase keys on node delete & add new
constructor(graph, renderer) {
// Checking the arguments
if (!isGraph(graph))
throw new Error('Sigma.constructor: given graph is not an instance of a graphology implementation.');
if (!(renderer instanceof Renderer))
throw new Error('Sigma.constructor: given renderer is not an instance of a sigma Renderer.');
// Properties
this.graph = graph;
this.renderer = renderer;
this.renderer.bind(this);
// Userland state
this.state = {};
this.nodeStates = null;
this.edgeStates = null;
// First time render