Interface Behavior<T>
interface Behavior<T> {
attachedNode: Nullable<T>;
name: string;
attach(target: T): void;
detach(): void;
init(): void;
}
attachedNode: Nullable<T>;
name: string;
attach(target: T): void;
detach(): void;
init(): void;
}
Type Parameters
- T
Implemented by
Properties
attached Node
Gets the current attached target
name
name: string
gets or sets behavior's name
Methods
attach
-
Called when the behavior is attached to a target
Parameters
- target: T
defines the target where the behavior is attached to
Returns void
- target: T
detach
-
Called when the behavior is detached from its target
Returns void
init
-
Function called when the behavior needs to be initialized (before attaching it to a target)
Returns void
Interface used to define a behavior