@rjfwhite/random-lib
Version:
Core engine for MML
28 lines • 1.03 kB
TypeScript
import { WorldMaker } from '../WorldMaker';
export interface AttachmentRule {
type: 'element' | 'class' | 'root';
selector: string;
}
export declare abstract class Behavior {
protected element: Element;
protected world: WorldMaker;
constructor(element: Element, world: WorldMaker);
protected getRootElement(): Element | null;
onAttach(): void;
onDetach(): void;
onAttributeChange(attributeName: string, oldValue: string | null, newValue: string | null): void;
tick(deltaTime: number): void;
static getAttachmentRules(): AttachmentRule[];
}
export interface BehaviorConstructor {
new (element: Element, world: WorldMaker): Behavior;
getAttachmentRules(): AttachmentRule[];
}
declare global {
interface Element {
getBehavior<T extends Behavior>(behaviorClass: new (element: Element, world: WorldMaker) => T): T | null;
hasBehavior(behaviorClass: BehaviorConstructor): boolean;
getAllBehaviors(): Behavior[];
}
}
//# sourceMappingURL=types.d.ts.map