Skip to content

Commit

Permalink
Replace Event constructor by CustomEvent
Browse files Browse the repository at this point in the history
  • Loading branch information
dixso committed Jan 27, 2017
1 parent b8417fb commit 60891b0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/custombox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ namespace Custombox {
}

static close(id?: string): void {
const event: Event = new Event(`${CB}:close`);
const event: Event = new CustomEvent(`${CB}:close`);
let elements: NodeListOf<Element> = document.querySelectorAll(`.${CB}-content`);

if (id) {
Expand All @@ -581,7 +581,7 @@ namespace Custombox {
}

static closeAll(): void {
const event: Event = new Event(`${CB}:close`);
const event: Event = new CustomEvent(`${CB}:close`);
const elements: NodeListOf<Element> = document.querySelectorAll(`.${CB}-content`);
const t = elements.length;

Expand Down Expand Up @@ -635,7 +635,7 @@ namespace Custombox {
// Private methods
private dispatchEvent(type: string): void {
const element: string = type.replace('.on', ':').toLowerCase();
const event: Event = new Event(`${CB}:${element}`);
const event: Event = new CustomEvent(`${CB}:${element}`);
const action: any = Object.create(this.options);

document.dispatchEvent(event);
Expand Down

0 comments on commit 60891b0

Please sign in to comment.