From 7a5de2cc0c8baae601906add8535fc1670a3876e Mon Sep 17 00:00:00 2001 From: Daeyeon Jeong Date: Sat, 23 Jul 2022 22:39:08 +0900 Subject: [PATCH] events: expose CustomEvent on global with CLI flag Signed-off-by: Daeyeon Jeong daeyeon.dev@gmail.com PR-URL: https://github.com/nodejs/node/pull/43885 Backport-PR-URL: https://github.com/nodejs/node/pull/44082 Fixes: https://github.com/nodejs/node/issues/40678 Refs: https://github.com/nodejs/node/pull/43514 Reviewed-By: Antoine du Hamel Reviewed-By: Luigi Pinca Reviewed-By: Darshan Sen Reviewed-By: Mestery --- .eslintrc.js | 1 + doc/api/cli.md | 10 ++++++++++ doc/api/globals.md | 15 +++++++++++++++ doc/node.1 | 3 +++ lib/.eslintrc.yaml | 2 ++ lib/internal/bootstrap/pre_execution.js | 13 +++++++++++++ lib/internal/main/worker_thread.js | 2 ++ src/node_options.cc | 4 ++++ src/node_options.h | 1 + test/common/index.js | 3 +++ test/parallel/test-global-customevent.js | 11 +++++++++++ test/wpt/status/dom/events.json | 6 +----- test/wpt/test-events.js | 2 ++ 13 files changed, 68 insertions(+), 5 deletions(-) create mode 100644 test/parallel/test-global-customevent.js diff --git a/.eslintrc.js b/.eslintrc.js index 3d0f283e781f75..0f11677ccabf0d 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -320,6 +320,7 @@ module.exports = { 'node-core/no-duplicate-requires': 'error', }, globals: { + CustomEvent: 'readable', Crypto: 'readable', CryptoKey: 'readable', fetch: 'readable', diff --git a/doc/api/cli.md b/doc/api/cli.md index b46469fc0a0788..0b54048d58abec 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md @@ -280,6 +280,14 @@ added: v16.15.0 Enable experimental support for the [Fetch API][]. +### `--experimental-global-customevent` + + + +Expose the [CustomEvent Web API][] on the global scope. + ### `--experimental-global-webcrypto` + +> Stability: 1 - Experimental. Enable this API with the +> [`--experimental-global-customevent`][] CLI flag. + + + +A browser-compatible implementation of the [`CustomEvent` Web API][]. + ## `Event`