This page describes all of the usable variables and functions inside of ComponentHandler.js, which handles everything component-related, including some JSON.

Table of contents

Component()

A constructor that returns a basic JSON object in order to construct a component. new Component() returns the following:

{
	active: true,
	type: 0,
	color: "#fff",
	radius: 2
}

Key phrases


All aspects of the Component part are modifiable by code by using <component type>.prototype = new Component() . Example of defining a component called VectorPoint:

function VectorPoint(x, y) {
	Component.call(this);
	this.type = 10;
	this.x = 0;
	this.y = 0;
	if (
		x != undefined &&
		y != undefined
	) {
		this.x = x;
		this.y = y;
	}
}
VectorPoint.prototype = new Component();
VectorPoint.prototype.constructor = VectorPoint;

If you are using classes, then consider the following (TypeScript).

class VectorPoint extends Component {
	x: number;
	y: number;
	constructor(x?: number, y?: number) {
		super();	
		this.type = 10;
		this.x = 0;
		this.y = 0;
		if (
			x != undefined &&
			y != undefined
		) {
			this.x = x;
			this.y = y;
		}
	}
}

Both of them will return this:

{
	active: true,
	type: 10,
	color: "#fff",
	radius: 2,
	x: 0,
	y: 0
}

Internal functions

Point()