From 98c1d36a8d95a07b707b30bf9d1b8d7ea57ca2be 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 3d0f283e781..0f11677ccab 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 b46469fc0a0..0b54048d58a 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`