UNPKG

@woosh/meep-engine

Version:

Pure JavaScript game engine. Fully featured and production ready.

39 lines (33 loc) 691 B
/** * A grouping node, intended mainly for meta-graphs, or hierarchical graphs * @template T */ export class MultiNode { /** * * @type {T[]} */ source_nodes = []; /** * Absorb nodes from another node * @param {MultiNode<T>} other */ add(other) { Array.prototype.push.apply(this.source_nodes, other.source_nodes); } /** * @template T * @param {T} t * @return {MultiNode<T>} */ static fromOne(t) { const r = new MultiNode(); r.source_nodes.push(t); return r; } } /** * * @type {boolean} */ MultiNode.prototype.isMultiNode = true;