From 0f8fda7d49d420887af835876c1867a5dbdd9d69 Mon Sep 17 00:00:00 2001 From: Erik Hesselink Date: Tue, 3 Dec 2013 16:01:08 +0100 Subject: [PATCH] jQuery: split out Event constructor in separate object. This way, it is possible to specialize constructor for certain strings to return a specific event type. --- jquery/jquery.d.ts | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/jquery/jquery.d.ts b/jquery/jquery.d.ts index c741d2ee2a..90fd9039e8 100644 --- a/jquery/jquery.d.ts +++ b/jquery/jquery.d.ts @@ -337,6 +337,18 @@ interface JQueryParam { (obj: any, traditional: boolean): string; } +/** + * The interface used to construct jQuery events (with $.Event). It is + * defined separately instead of inline in JQueryStatic to allow + * overriding the construction function with specific strings + * returning specific event objects. + */ +interface JQueryEventConstructor { + (name: string, eventProperties?: any): JQueryEventObject; + new (name: string, eventProperties?: any): JQueryEventObject; +} + + /* Static members of jQuery (those on $ and jQuery themselves) */ @@ -434,10 +446,7 @@ interface JQueryStatic { proxy(fn: (...args: any[]) => any, context: any, ...args: any[]): any; proxy(context: any, name: string, ...args: any[]): any; - Event: { - (name: string, eventProperties?: any): JQueryEventObject; - new (name: string, eventProperties?: any): JQueryEventObject; - }; + Event: JQueryEventConstructor; // Internals error(message: any): JQuery;