summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author迷渡 <justjavac@gmail.com>2019-03-28 20:08:32 +0800
committerRyan Dahl <ry@tinyclouds.org>2019-03-28 08:08:32 -0400
commit1fec34b4632521068c31815c1d9f92286b6d0297 (patch)
treeeb6b6a837802501e72cc155558c663afce1b3b9c
parent8ac36d8db421864604a835c50a68411b3f69d62a (diff)
Check `CustomEvent` constructor params (#2011)
-rw-r--r--js/custom_event.ts3
1 files changed, 2 insertions, 1 deletions
diff --git a/js/custom_event.ts b/js/custom_event.ts
index d2092a2be..713794e28 100644
--- a/js/custom_event.ts
+++ b/js/custom_event.ts
@@ -1,7 +1,7 @@
// Copyright 2018 the Deno authors. All rights reserved. MIT license.
import * as domTypes from "./dom_types";
import * as event from "./event";
-import { getPrivateValue } from "./util";
+import { getPrivateValue, requiredArguments } from "./util";
// 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
@@ -28,6 +28,7 @@ export class CustomEvent extends event.Event implements domTypes.CustomEvent {
type: string,
customEventInitDict: domTypes.CustomEventInit = {}
) {
+ requiredArguments("CustomEvent", arguments.length, 1);
super(type, customEventInitDict);
const { detail = null } = customEventInitDict;
customEventAttributes.set(this, { detail });