diff options
author | Benjamin Gruenbaum <benjamingr@gmail.com> | 2020-05-30 02:56:01 +0300 |
---|---|---|
committer | James M Snell <jasnell@gmail.com> | 2020-06-24 03:08:10 +0300 |
commit | 9d324f0441688cef6b9403f2492e6d41cc6a2fc2 (patch) | |
tree | bfcbdb1faf4fec55a6eeb42eba1a5dde1b77e1c8 /lib/internal/event_target.js | |
parent | a30babf6720f1afaa47dfc47c7e970f541cce312 (diff) |
events: expose Event statics
PR-URL: https://github.com/nodejs/node/pull/34015
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Diffstat (limited to 'lib/internal/event_target.js')
-rw-r--r-- | lib/internal/event_target.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/internal/event_target.js b/lib/internal/event_target.js index fd26a37df3f..7c34acd5c5d 100644 --- a/lib/internal/event_target.js +++ b/lib/internal/event_target.js @@ -125,7 +125,7 @@ class Event { get bubbles() { return this.#bubbles; } get composed() { return this.#composed; } get eventPhase() { - return this[kTarget] ? 2 : 0; // Equivalent to AT_TARGET or NONE + return this[kTarget] ? Event.AT_TARGET : Event.NONE; } get cancelBubble() { return this.#propagationStopped; } set cancelBubble(value) { @@ -136,6 +136,11 @@ class Event { stopPropagation() { this.#propagationStopped = true; } + + static NONE = 0; + static CAPTURING_PHASE = 1; + static AT_TARGET = 2; + static BUBBLING_PHASE = 3; } Object.defineProperty(Event.prototype, SymbolToStringTag, { |