| @@ -1,4 +1,4 | |||
| 
             | 
        1 | import { djbase, djclass } from "../declare"; | |
| 
             | 
        1 | import { djbase, djclass, prototype } from "../declare"; | |
| 
             | 
        2 | 2 | import _WidgetBase = require("dijit/_WidgetBase"); | 
| 
             | 
        3 | 3 | import _AttachMixin = require("dijit/_AttachMixin"); | 
| 
             | 
        4 | 4 | import { Rendition, isNode } from "./traits"; | 
| @@ -21,6 +21,16 export interface DjxWidgetBase<Attrs = { | |||
| 
             | 
        21 | 21 | * and should not be used. | 
| 
             | 
        22 | 22 | */ | 
| 
             | 
        23 | 23 | readonly _eventMap: Events & GlobalEventHandlersEventMap; | 
| 
             | 
        24 | ||
| 
             | 
        25 | /** The list of pairs of event and method names. When the widget is created all methods from | |
| 
             | 
        26 | * this list will be connected to corresponding events. | |
| 
             | 
        27 | * | |
| 
             | 
        28 | * This property is maintained in the prototype | |
| 
             | 
        29 | */ | |
| 
             | 
        30 | _eventHandlers: Array<{ | |
| 
             | 
        31 | eventName: string, | |
| 
             | 
        32 | handlerMethod: keyof any; | |
| 
             | 
        33 | }>; | |
| 
             | 
        24 | 34 | } | 
| 
             | 
        25 | 35 | |
| 
             | 
        26 | 36 | type _super = { | 
| @@ -30,14 +40,6 type _super = { | |||
| 
             | 
        30 | 40 | @djclass | 
| 
             | 
        31 | 41 | export abstract class DjxWidgetBase<Attrs = {}, Events = {}> extends djbase<_super, _AttachMixin>(_WidgetBase, _AttachMixin) { | 
| 
             | 
        32 | 42 | |
| 
             | 
        33 | /** The list of pairs of event and method names. When the widget is created all methods from | |
| 
             | 
        34 | * this list will be connected to corresponding events. | |
| 
             | 
        35 | */ | |
| 
             | 
        36 | _eventHandlers: Array<{ | |
| 
             | 
        37 | eventName: string, | |
| 
             | 
        38 | handlerMethod: keyof any; | |
| 
             | 
        39 | }> = []; | |
| 
             | 
        40 | ||
| 
             | 
        41 | 43 | buildRendering() { | 
| 
             | 
        42 | 44 | this.domNode = this.render().getDomNode(); | 
| 
             | 
        43 | 45 | super.buildRendering(); | 
| @@ -223,5 +223,8 export const on = <E extends string>(eve | |||
| 
             | 
        223 | 223 | key: K, | 
| 
             | 
        224 | 224 | _descriptor: TypedPropertyDescriptor<(eventObj: EV) => void> | TypedPropertyDescriptor<() => void> | 
| 
             | 
        225 | 225 | ): any => { | 
| 
             | 
        226 | target._eventHandlers.push({ eventName, handlerMethod: key }); | |
| 
             | 
        226 | if(!target._eventHandlers) | |
| 
             | 
        227 | target._eventHandlers = [{ eventName, handlerMethod: key }]; | |
| 
             | 
        228 | else | |
| 
             | 
        229 | target._eventHandlers.push({ eventName, handlerMethod: key }); | |
| 
             | 
        227 | 230 | }; | 
        
        General Comments 0
    
    
  
  
                      You need to be logged in to leave comments.
                      Login now
                    
                