export declare class ListItem { private _host; private _prev; private _next; private _value; constructor(host: List, prev: ListItem | null, next: ListItem | null, value: T); get host(): List | null; get prev(): ListItem | null; get next(): ListItem | null; get value(): T; set value(value: T); } /** * @class List linked */ export declare class List { private _first; private _last; private _length; get first(): ListItem | null; get last(): ListItem | null; get length(): number; del(item: ListItem): ListItem | null; delete(item: ListItem): ListItem | null; unshift(value: T): ListItem; push(value: T): ListItem; pop(): T | null; shift(): T | null; insert(prev: ListItem, value: T): ListItem; clear(): void; } /** * @class Event */ export declare class Event { private _data; protected _noticer: EventNoticer> | null; private _origin; returnValue: number; get name(): string; get data(): Data; get sender(): Sender; get origin(): Origin; get noticer(): EventNoticer> | null; constructor(data: Data, origin?: Origin); } declare type DefaultEvent = Event; export interface Listen { (this: Scope, evt: Event): any; } export interface Listen2 { (self: Scope, evt: Event): any; } export declare class EventNoticer { private m_name; private m_sender; private m_listens; private m_listens_map; private m_length; private m_enable; private _add; /** * @get enable {bool} # 获取是否已经启用 */ get enable(): boolean; /** * @set enable {bool} # 设置, 启用/禁用 */ set enable(value: boolean); /** * @get name {String} # 事件名称 */ get name(): string; /** * @get {Object} # 事件发送者 */ get sender(): any; /** * * @get {int} # 添加的事件侦听数量 */ get length(): number; /** * @constructor * @arg name {String} # 事件名称 * @arg sender {Object} # 事件发起者 */ constructor(name: string, sender: object); /** * @fun on # 绑定一个事件侦听器(函数) * @arg listen {Function} # 侦听函数 * @arg [scope] {Object} # 重新指定侦听函数this * @arg [id] {String} # 侦听器别名,可通过id删除 */ on(listen: Listen, scopeOrId?: Scope | string, id?: string): string; /** * @fun once # 绑定一个侦听器(函数),且只侦听一次就立即删除 * @arg listen {Function} # 侦听函数 * @arg [scope] {Object} # 重新指定侦听函数this * @arg [id] {String} # 侦听器别名,可通过id删除 */ once(listen: Listen, scopeOrId?: Scope | string, id?: string): string; /** * Bind an event listener (function), * and "on" the same processor of the method to add the event trigger to receive two parameters * @fun on2 * @arg listen {Function} # 侦听函数 * @arg [scope] {Object} # 重新指定侦听函数this * @arg [id] {String} # 侦听器别名,可通过id删除 */ on2(listen: Listen2, scopeOrId?: Scope | string, id?: string): string; /** * Bind an event listener (function), And to listen only once and immediately remove * and "on" the same processor of the method to add the event trigger to receive two parameters * @fun once2 * @arg listen {Function} # 侦听函数 * @arg [scope] {Object} # 重新指定侦听函数this * @arg [id] {String} # 侦听器id,可通过id删除 */ once2(listen: Listen2, scopeOrId?: Scope | string, id?: string): string; forward(noticer: EventNoticer, id?: string): string; forwardOnce(noticer: EventNoticer, id?: string): string; /** * @fun trigger # 通知所有观察者 * @arg data {Object} # 要发送的数据 * @ret {Object} */ trigger(data?: any): void; /** * @fun triggerWithEvent # 通知所有观察者 * @arg data {Object} 要发送的event * @ret {Object} */ triggerWithEvent(evt: E): void; /** * @fun off # 卸载侦听器(函数) * @arg [func] {Object} # 可以是侦听函数,id,如果不传入参数卸载所有侦听器 * @arg [scope] {Object} # scope */ off(listen?: string | Function | object, scope?: object): void; } export declare const VOID: any; /** * @class Notification */ export declare class Notification { /** * @func getNoticer */ getNoticer(name: string): EventNoticer; /** * @func hasNoticer */ hasNoticer(name: string): boolean; /** * @func addDefaultListener */ addDefaultListener(name: string, listen: Listen | null): void; /** * @func addEventListener(name, listen[,scope[,id]]) */ addEventListener(name: string, listen: Listen, scopeOrId?: Scope | string, id?: string): string; /** * @func addEventListenerOnce(name, listen[,scope[,id]]) */ addEventListenerOnce(name: string, listen: Listen, scopeOrId?: Scope | string, id?: string): string; /** * @func addEventListener2(name, listen[,scope[,id]]) */ addEventListener2(name: string, listen: Listen2, scopeOrId?: Scope | string, id?: string): string; /** * @func addEventListenerOnce2(name, listen[,scope[,id]]) */ addEventListenerOnce2(name: string, listen: Listen2, scopeOrId?: Scope | string, id?: string): string; addEventForward(name: string, noticer: EventNoticer, id?: string): string; addEventForwardOnce(noticer: EventNoticer, id?: string): string; /** * @func trigger 通知事监听器 * @arg name {String} 事件名称 * @arg data {Object} 要发送的消数据 */ trigger(name: string, data?: any): void; /** * @func triggerWithEvent 通知事监听器 * @arg name {String} 事件名称 * @arg event {Event} Event */ triggerWithEvent(name: string, event: E): void; /** * @func removeEventListener(name,[func[,scope]]) */ removeEventListener(name: string, listen?: string | Function | object, scope?: object): void; /** * @func removeEventListenerWithScope(scope) 卸载notification上所有与scope相关的侦听器 * @arg scope {Object} */ removeEventListenerWithScope(scope: object): void; /** * @func allNoticers() # Get all event noticer * @ret {Array} */ allNoticers(): EventNoticer[]; /** * @func triggerListenerChange */ triggerListenerChange(name: string, count: number, change: number): void; } export declare function event(target: any, name: string): void; export {}; declare const _default: (target: any, name: string) => void; export default _default;