From b81e5db17aa8b3088d6034ddf86b79c69410f012 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Fri, 4 Oct 2019 20:28:51 -0400 Subject: Merge deno_cli_snapshots into deno_cli (#3064) --- js/custom_event.ts | 48 ------------------------------------------------ 1 file changed, 48 deletions(-) delete mode 100644 js/custom_event.ts (limited to 'js/custom_event.ts') diff --git a/js/custom_event.ts b/js/custom_event.ts deleted file mode 100644 index 922abd4b1..000000000 --- a/js/custom_event.ts +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2018 the Deno authors. All rights reserved. MIT license. -import * as domTypes from "./dom_types.ts"; -import * as event from "./event.ts"; -import { getPrivateValue, requiredArguments } from "./util.ts"; - -// WeakMaps are recommended for private attributes (see MDN link below) -// https://developer.mozilla.org/en-US/docs/Archive/Add-ons/Add-on_SDK/Guides/Contributor_s_Guide/Private_Properties#Using_WeakMaps -export const customEventAttributes = new WeakMap(); - -export class CustomEvent extends event.Event implements domTypes.CustomEvent { - constructor( - type: string, - customEventInitDict: domTypes.CustomEventInit = {} - ) { - requiredArguments("CustomEvent", arguments.length, 1); - super(type, customEventInitDict); - const { detail = null } = customEventInitDict; - customEventAttributes.set(this, { detail }); - } - - // eslint-disable-next-line @typescript-eslint/no-explicit-any - get detail(): any { - return getPrivateValue(this, customEventAttributes, "detail"); - } - - initCustomEvent( - type: string, - bubbles?: boolean, - cancelable?: boolean, - // eslint-disable-next-line @typescript-eslint/no-explicit-any - detail?: any - ): void { - if (this.dispatched) { - return; - } - - customEventAttributes.set(this, { detail }); - } - - get [Symbol.toStringTag](): string { - return "CustomEvent"; - } -} - -/** Built-in objects providing `get` methods for our - * interceptable JavaScript operations. - */ -Reflect.defineProperty(CustomEvent.prototype, "detail", { enumerable: true }); -- cgit v1.2.3