Skip to content

Commit 42f5f13

Browse files
committed
Do not emit resize event when not built
1 parent 0122564 commit 42f5f13

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/types/events/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,5 +143,5 @@ export interface VideomailEvents {
143143
// document just became visible
144144
VISIBLE: () => void;
145145
// when window's inner width has changed
146-
WINDOW_RESIZE: () => void;
146+
WINDOW_RESIZE: (source: string) => void;
147147
}

src/wrappers/container.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,11 @@ class Container extends Despot {
237237
this.options.logger.debug(`Container: initEvents (playerOnly = ${playerOnly})`);
238238

239239
window.addEventListener("resize", () => {
240-
this.emit("WINDOW_RESIZE");
240+
if (!this.built) {
241+
return;
242+
}
243+
244+
this.emit("WINDOW_RESIZE", "container");
241245
});
242246

243247
if (this.options.enableAutoUnload) {

0 commit comments

Comments
 (0)