import "../keys"; declare class Connect { /** * WIP: Type this better */ _keypress: (object: any, listener: EventListener) => DojoJS.Handle; /** * `dojo.connect` is a deprecated event handling and delegation method in * Dojo. It allows one function to "listen in" on the execution of * any other, triggering the second whenever the first is called. Many * listeners may be attached to a function, and source functions may * be either regular function calls or DOM events. */ connect(event: DojoJS.ConnectGlobalEvent, method: DojoJS.Global extends DojoJS.WithFunc> ? M : never, dontFix?: boolean): DojoJS.Handle; connect>>(event: DojoJS.ConnectGlobalEvent, method: M, dontFix?: boolean): DojoJS.Handle; connect(...[event, scope, method, dontFix]: [ DojoJS.ConnectGlobalEvent, ...DojoJS.HitchedPair>, boolean? ]): DojoJS.Handle; connect>>(event: DojoJS.ConnectGlobalEvent, scope: S, method: M, dontFix?: boolean): DojoJS.Handle; connect(targetObject: DojoJS.ConnectListenerTarget, event: K | `on${K}`, method: DojoJS.Global extends DojoJS.WithFunc ? M : never, dontFix?: boolean): DojoJS.Handle; connect>>(targetObject: DojoJS.ConnectListenerTarget, event: K | `on${K}`, method: M, dontFix?: boolean): DojoJS.Handle; connect(...[targetObject, event, scope, method, dontFix]: [ DojoJS.ConnectListenerTarget, K | `on${K}`, ...DojoJS.HitchedPair, boolean? ]): DojoJS.Handle; connect>(targetObject: DojoJS.ConnectListenerTarget, event: K | `on${K}`, scope: S, method: M, dontFix?: boolean): DojoJS.Handle; connect, U extends string, M extends keyof DojoJS.Global>(targetObject: T, event: U, method: DojoJS.Global extends DojoJS.WithFunc> ? M : never, dontFix?: boolean): DojoJS.Handle; connect, U extends string, M extends DojoJS.BoundFunc>>(targetObject: T, event: U, method: M, dontFix?: boolean): DojoJS.Handle; connect, U extends string, S, M extends keyof any>(...[targetObject, event, scope, method, dontFix]: [ T, U, ...DojoJS.HitchedPair>, boolean? ]): DojoJS.Handle; connect, U extends string, S, M extends DojoJS.BoundFunc>>(targetObject: T, event: U, scope: S, method: M, dontFix?: boolean): DojoJS.Handle; /** * Remove a link created by dojo.connect. */ disconnect(handle: DojoJS.Handle | Falsy): void; /** * Attach a listener to a named topic. The listener function is invoked whenever the * named topic is published (see: dojo.publish). * Returns a handle which is needed to unsubscribe this listener. */ subscribe(topic: string, method: DojoJS.Global extends DojoJS.WithFunc ? M : never): DojoJS.Handle; subscribe, Args extends any[] = any[]>(topic: string, method: M): DojoJS.Handle; subscribe(...[topic, scope, method]: [string, ...DojoJS.HitchedPair]): DojoJS.Handle; subscribe, Args extends any[] = any[]>(topic: string, scope: S, method: M): DojoJS.Handle; unsubscribe(handle: DojoJS.Handle | null): void; /** * Invoke all listener method subscribed to topic. */ publish(topic: string, args?: any[] | null): boolean; /** * Ensure that every time obj.event() is called, a message is published * on the topic. Returns a handle which can be passed to * dojo.disconnect() to disable subsequent automatic publication on * the topic. */ connectPublisher(topic: string, event: any, method: DojoJS.Global extends DojoJS.WithFunc ? M : never): DojoJS.Handle; connectPublisher, Args extends any[] = any[]>(topic: string, event: any, method: M): DojoJS.Handle; /** * Checks an event for the copy key (meta on Mac, and ctrl anywhere else) */ isCopyKey(e: Event): boolean; } declare global { namespace DojoJS { interface Dojo extends Connect { } type AllEvents = WindowEventMap & GlobalEventHandlersEventMap & WindowEventHandlersEventMap & DocumentEventMap & ElementEventMap; type ConnectGlobalEvent = keyof WindowEventMap | ((Window & typeof globalThis) extends { [K in U]: (((...args: any[]) => any) | Event); } ? U : never); type ConnectGlobalEventParams = U extends keyof WindowEventMap ? [WindowEventMap[U]] : (Window & typeof globalThis) extends { [K in U]: infer F extends (((...args: any[]) => any) | Event); } ? F extends (...args: any[]) => any ? Parameters : [Element] : never; type ConnectListenerTarget = { addEventListener(e: keyof AllEvents, l: (evt: AllEvents[K]) => any): void; }; type ConnectMethodTarget = object & { [K in U]: ((...args: any[]) => any) | Event | null; }; type ConnectMethodParams, U extends keyof any> = Exclude extends infer F extends (...args: any[]) => any ? Parameters : [Element]; } } declare var connect: Connect; export = connect; //# sourceMappingURL=connect.d.ts.map