22// Project: https://golden-layout.com/
33
44declare module 'golden-layout' {
5-
6- class GoldenLayout {
5+ class GoldenLayout implements GoldenLayout . EventEmitter {
76 /**
87 * The topmost item in the layout item tree. In browser terms: Think of the GoldenLayout instance as window
98 * object and of goldenLayout.root as the document.
@@ -62,7 +61,7 @@ declare module 'golden-layout' {
6261 * @param config A GoldenLayout configuration object
6362 * @param container The DOM element the layout will be initialised in. Default: document.body
6463 */
65- constructor ( configuration : GoldenLayout . Config , container ?: HTMLElement | JQuery ) ;
64+ constructor ( configuration : GoldenLayout . Config , container ?: Element | HTMLElement | JQuery ) ;
6665
6766 /*
6867 * @param name The name of the component, as referred to by componentName in the component configuration.
@@ -110,7 +109,6 @@ declare module 'golden-layout' {
110109 */
111110 createContentItem ( itemConfiguration ?: GoldenLayout . ItemConfigType , parent ?: GoldenLayout . ContentItem ) : void ;
112111
113-
114112 /**
115113 * Creates a new popout window with configOrContentItem as contents at the position specified in dimensions
116114 * @param configOrContentItem The content item or config that will be created in the new window. If a item is
@@ -123,13 +121,13 @@ declare module 'golden-layout' {
123121 * @param indexInParent The index at which the child window's contents will be appended to. Default: null
124122 */
125123 createPopout ( configOrContentItem : GoldenLayout . ItemConfigType | GoldenLayout . ContentItem ,
126- dimensions : {
127- width : number ,
128- height : number ,
129- left : number ,
130- top : number
131- } , parentId ?: string ,
132- indexInParent ?: number ) : void ;
124+ dimensions : {
125+ width : number ,
126+ height : number ,
127+ left : number ,
128+ top : number
129+ } , parentId ?: string ,
130+ indexInParent ?: number ) : void ;
133131
134132 /**
135133 * Turns a DOM element into a dragSource, meaning that the user can drag the element directly onto the layout
@@ -157,6 +155,40 @@ declare module 'golden-layout' {
157155 * @param minifiedConfig A minified GoldenLayout configuration object
158156 */
159157 static unminifyConfig ( minifiedConfig : any ) : any ;
158+
159+ /**
160+ * Subscribe to an event
161+ * @param eventName The name of the event to describe to
162+ * @param callback The function that should be invoked when the event occurs
163+ * @param context The value of the this pointer in the callback function
164+ */
165+ on ( eventName : string , callback : Function , context ?: any ) : void ;
166+
167+ /**
168+ * Notify listeners of an event and pass arguments along
169+ * @param eventName The name of the event to emit
170+ */
171+ emit ( eventName : string , arg1 ?: any , arg2 ?: any , ...argN : any [ ] ) : void ;
172+
173+ /**
174+ * Alias for emit
175+ */
176+ trigger ( eventName : string , arg1 ?: any , arg2 ?: any , ...argN : any [ ] ) : void ;
177+
178+ /**
179+ * Unsubscribes either all listeners if just an eventName is provided, just a specific callback if invoked with
180+ * eventName and callback or just a specific callback with a specific context if invoked with all three
181+ * arguments.
182+ * @param eventName The name of the event to unsubscribe from
183+ * @param callback The function that should be invoked when the event occurs
184+ * @param context The value of the this pointer in the callback function
185+ */
186+ unbind ( eventName : string , callback ?: Function , context ?: any ) : void ;
187+
188+ /**
189+ * Alias for unbind
190+ */
191+ off ( eventName : string , callback ?: Function , context ?: any ) : void ;
160192 }
161193
162194 namespace GoldenLayout {
@@ -222,13 +254,13 @@ declare module 'golden-layout' {
222254 * Specifies if the maximise icon should be displayed in the header-bar.
223255 * Default: true
224256 */
225- showMaximiseIcon : boolean ;
257+ showMaximiseIcon ? : boolean ;
226258
227259 /**
228260 * Specifies if the close icon should be displayed in the header-bar.
229261 * Default: true
230262 */
231- showCloseIcon : boolean ;
263+ showCloseIcon ? : boolean ;
232264 }
233265
234266 export interface Dimensions {
@@ -366,7 +398,7 @@ declare module 'golden-layout' {
366398 settings ?: Settings ;
367399 dimensions ?: Dimensions ;
368400 labels ?: Labels ;
369- content : ItemConfigType [ ] ;
401+ content ? : ItemConfigType [ ] ;
370402 }
371403
372404 export interface ContentItem extends EventEmitter {
@@ -462,7 +494,7 @@ declare module 'golden-layout' {
462494
463495 /**
464496 * The contentItem that should be removed
465- * @param oldChild ContentItem The contentItem that should be removed
497+ * @param oldChild ContentItem The contentItem that should be removed
466498 * @param newChild A content item (or tree of content items) or an ItemConfiguration to create the item from
467499 */
468500 replaceChild ( oldChild : ContentItem , newChild : ContentItem | ItemConfigType ) : void ;
@@ -631,7 +663,7 @@ declare module 'golden-layout' {
631663 getState ( ) : any ;
632664
633665 /**
634- * Returns the container's inner element as a jQuery element
666+ * Returns the container's inner element as a jQuery element
635667 */
636668 getElement ( ) : JQuery ;
637669
@@ -718,7 +750,6 @@ declare module 'golden-layout' {
718750 */
719751 parent : ContentItem ;
720752
721-
722753 /**
723754 * An array of the Tabs within this header
724755 */
@@ -847,5 +878,4 @@ declare module 'golden-layout' {
847878 }
848879
849880 export = GoldenLayout ;
850-
851881}
0 commit comments