UNPKG

@woosh/meep-engine

Version:

Pure JavaScript game engine. Fully featured and production ready.

100 lines 2.45 kB
export class NodeRegistry { /** * ID -> Node mapping * @type {Map<number, NodeDescription>} */ nodes: Map<number, NodeDescription>; /** * ID -> DataType mapping * @type {Map<number, DataType>} */ types: Map<number, DataType>; /** * @returns {NodeDescription[]} */ getNodesAsArray(): NodeDescription[]; /** * * @param {NodeDescription} node * @returns {boolean} true if node was added, false if node already exists */ addNode(node: NodeDescription): boolean; /** * * @param {NodeDescription} node * @returns {boolean} */ hasNode(node: NodeDescription): boolean; /** * * @param {NodeDescription} node * @returns {boolean} */ removeNode(node: NodeDescription): boolean; /** * Given a class inheriting from NodeDescription, get all registered instances * Matching is strict, instances of subclasses are not matched * @param {Type<NodeDescription>} Klass * @returns {NodeDescription[]} */ getNodesByClass(Klass: Type<NodeDescription>): NodeDescription[]; /** * * @param {DataType} type */ addType(type: DataType): boolean; /** * * @param {DataType} type * @return {boolean} */ hasType(type: DataType): boolean; /** * @param {number} id * @returns {DataType|undefined} */ getTypeById(id: number): DataType | undefined; /** * * @returns {number} */ generateTypeId(): number; /** * * @param {String} name * @returns {DataType} */ createType(name: string): DataType; /** * * @param {number} id * @returns {NodeDescription|undefined} */ getNode(id: number): NodeDescription | undefined; /** * * @param json * @returns {Port} */ parsePort(json: any): Port; /** * NOTE: this only works with un-extended node descriptions * @param json * @returns {NodeDescription} */ parseNode(json: any): NodeDescription; fromJSON(json: any): void; toJSON(): { types: {}; nodes: {}; }; /** * @readonly * @type {boolean} */ readonly isNodeRegistry: boolean; } import { NodeDescription } from "./NodeDescription.js"; import { DataType } from "../type/DataType.js"; import { Port } from "./Port.js"; //# sourceMappingURL=NodeRegistry.d.ts.map