@@ -780,7 +780,7 @@ interface DomObserverConfig {
780
780
handler ?: Function ;
781
781
}
782
782
783
- interface GmailObserve {
783
+ interface GmailObserve < T extends string = never > {
784
784
/**
785
785
After an observer has been bound through gmail.observe.bind() (via a
786
786
call to events gmail.observe.before(), gmail.observe.on(), or
@@ -821,31 +821,31 @@ interface GmailObserve {
821
821
Your callback will be fired directly after Gmail's XMLHttpRequest
822
822
has been sent off the the Gmail servers.
823
823
*/
824
- on ( action : GmailBindAction , callback : Function , response_callback ?: Function ) : void ;
824
+ on ( action : GmailBindAction | T , callback : Function , response_callback ?: Function ) : void ;
825
825
/**
826
826
an before event is observed just prior to the gmail xhr request being sent
827
827
before events have the ability to modify the xhr request before it is sent
828
828
*/
829
- before ( action : GmailBindAction , callback : Function ) : void ;
829
+ before ( action : GmailBindAction | T , callback : Function ) : void ;
830
830
/**
831
831
an after event is observed when the gmail xhr request returns from the server
832
832
with the server response
833
833
*/
834
834
after ( action : "send_message" , callback : ( url : string , body : string , data : any , response : any , xhr : XMLHttpRequest ) => void ) : void ;
835
835
after ( action : "http_event" , callback : ( request : HttpEventRequestParams , responseData : any , xhr : XMLHttpRequest ) => void ) : void ;
836
- after ( action : GmailBindAction , callback : Function ) : void ;
836
+ after ( action : GmailBindAction | T , callback : Function ) : void ;
837
837
/**
838
838
Checks if a specified action & type has anything bound to it
839
839
If type is null, will check for this action bound on any type
840
840
If action is null, will check for any actions bound to a type
841
841
*/
842
- bound ( action : GmailBindAction , type : GmailBindType ) : boolean ;
842
+ bound ( action : GmailBindAction | T , type : GmailBindType ) : boolean ;
843
843
/**
844
844
Clear all callbacks for a specific type (before, on, after, dom) and action
845
845
If action is null, all actions will be cleared
846
846
If type is null, all types will be cleared
847
847
*/
848
- off ( action : GmailBindAction , type : GmailBindType ) : void ;
848
+ off ( action : GmailBindAction | T , type : GmailBindType ) : void ;
849
849
/**
850
850
Trigger any specified events bound to the passed type
851
851
Returns true or false depending if any events were fired
@@ -873,7 +873,7 @@ interface GmailObserve {
873
873
trigger the related event and fire off any relevant bound callbacks
874
874
This function should return true if a dom observer is found for the specified action
875
875
*/
876
- on_dom ( action : GmailBindAction , callback : Function ) : void ;
876
+ on_dom ( action : GmailBindAction | T , callback : Function ) : boolean ;
877
877
}
878
878
879
879
@@ -1030,7 +1030,7 @@ interface GmailCache {
1030
1030
//
1031
1031
////////////////////////////////////////////////////////////////////////////////
1032
1032
1033
- declare class Gmail {
1033
+ declare class Gmail < T extends string = never > {
1034
1034
constructor ( localJQuery ?: JQueryStatic ) ;
1035
1035
1036
1036
version : string ;
@@ -1050,7 +1050,7 @@ declare class Gmail {
1050
1050
use. See source for input params
1051
1051
*/
1052
1052
tools : GmailTools ;
1053
- observe : GmailObserve ;
1053
+ observe : GmailObserve < T > ;
1054
1054
helper : GmailHelper ;
1055
1055
chat : GmailChat ;
1056
1056
compose : GmailCompose ;
0 commit comments