import { IGraph } from '.' import { GEventName } from './event' export interface IBehaviorInner> { type: string graph: IGraph cfg: Config get: (key: string) => any set: (key: string, value: any) => void bindEvents: Record } export interface EventBehavior { [key: string]: (...args: any) => any } export type BehaviorOption< Eventors extends EventBehaviorFunc, Config extends Record > = EventBehavior & { getDefaultCfg?: () => Config getEvents: () => Record events: ThisType & EventBehaviorReturnTypes> } export type BaseBehavior< Eventors extends EventBehaviorFunc, Config extends Record > = BehaviorOption & { bind: (this: IBehaviorInner & EventBehaviorReturnTypes, g: IGraph) => void unbind: (this: IBehaviorInner & EventBehaviorReturnTypes, g: IGraph) => void } export type EventBehaviorFunc = Record any> export type EventBehaviorReturnTypes = { [K in keyof T]: ReturnType } export interface BehaviorConfig { cfg?: Record type: string } export type IBehavior> = IBehaviorInner & BaseBehavior