| @@ -1,4 +1,4 | |||||
| 1 | import { djbase, djclass } from "../declare"; | 
             | 
        1 | import { djbase, djclass, prototype } from "../declare"; | |
| 2 | import _WidgetBase = require("dijit/_WidgetBase"); | 
             | 
        2 | import _WidgetBase = require("dijit/_WidgetBase"); | |
| 3 | import _AttachMixin = require("dijit/_AttachMixin"); | 
             | 
        3 | import _AttachMixin = require("dijit/_AttachMixin"); | |
| 4 | import { Rendition, isNode } from "./traits"; | 
             | 
        4 | import { Rendition, isNode } from "./traits"; | |
| @@ -21,6 +21,16 export interface DjxWidgetBase<Attrs = { | |||||
| 21 | * and should not be used. | 
             | 
        21 | * and should not be used. | |
| 22 | */ | 
             | 
        22 | */ | |
| 23 | readonly _eventMap: Events & GlobalEventHandlersEventMap; | 
             | 
        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 | type _super = { | 
             | 
        36 | type _super = { | |
| @@ -30,14 +40,6 type _super = { | |||||
| 30 | @djclass | 
             | 
        40 | @djclass | |
| 31 | export abstract class DjxWidgetBase<Attrs = {}, Events = {}> extends djbase<_super, _AttachMixin>(_WidgetBase, _AttachMixin) { | 
             | 
        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 | buildRendering() { | 
             | 
        43 | buildRendering() { | |
| 42 | this.domNode = this.render().getDomNode(); | 
             | 
        44 | this.domNode = this.render().getDomNode(); | |
| 43 | super.buildRendering(); | 
             | 
        45 | super.buildRendering(); | |
| @@ -223,5 +223,8 export const on = <E extends string>(eve | |||||
| 223 | key: K, | 
             | 
        223 | key: K, | |
| 224 | _descriptor: TypedPropertyDescriptor<(eventObj: EV) => void> | TypedPropertyDescriptor<() => void> | 
             | 
        224 | _descriptor: TypedPropertyDescriptor<(eventObj: EV) => void> | TypedPropertyDescriptor<() => void> | |
| 225 | ): any => { | 
             | 
        225 | ): any => { | |
| 
             | 
        226 | if(!target._eventHandlers) | |||
| 
             | 
        227 | target._eventHandlers = [{ eventName, handlerMethod: key }]; | |||
| 
             | 
        228 | else | |||
| 226 | target._eventHandlers.push({ eventName, handlerMethod: key }); | 
             | 
        229 | target._eventHandlers.push({ eventName, handlerMethod: key }); | |
| 227 | }; | 
             | 
        230 | }; | |
        
        General Comments 0
    
    
  
  
                      You need to be logged in to leave comments.
                      Login now
                    
                