ecspresso
Version:
A minimal Entity-Component-System library for typescript and javascript.
13 lines (12 loc) • 550 B
TypeScript
/**
* BFS cycle detection for required component graphs.
* Shared by ECSpresso and Plugin.
*
* @param trigger The component that triggers the requirement
* @param newRequired The component about to be added as required
* @param getRequirements Callback returning the existing requirements for a component
* @throws Error if adding trigger→newRequired would create a cycle
*/
export declare function checkRequiredCycle<K>(trigger: K, newRequired: K, getRequirements: (component: K) => Iterable<{
component: K;
}> | undefined): void;