DEV: Prepare lib/ember-events for Ember upgrade (#24565)

Extracted from https://github.com/discourse/discourse/pull/21720. This is a no-op under our current Ember 3.28 version.
This commit is contained in:
David Taylor 2023-11-27 14:00:30 +00:00 committed by GitHub
parent 056898c55f
commit 04164f7dda
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,6 +3,7 @@ import Component from "@ember/component";
import EmberObject from "@ember/object";
import Ember from "ember";
import { actionModifier } from "./ember-action-modifier";
import { EMBER_MAJOR_VERSION } from "./ember-version";
/**
* Classic Ember components (i.e. "@ember/component") rely upon "event
@ -126,13 +127,16 @@ function rewireClassicComponentEvents(app) {
allEventMethods[methodName] = event;
}
const triggerOverrideMethod =
EMBER_MAJOR_VERSION < 4 ? "trigger" : "_trigger";
// Avoid Component.reopen to stop `ember.component.reopen` deprecation warning
EmberObject.reopen.call(Component, {
/**
* @param {string | typeof INTERNAL} name
* @param {unknown[]} args
*/
trigger(name, ...args) {
[triggerOverrideMethod](name, ...args) {
if (name === INTERNAL) {
if (this.element) {
return this._super.call(this, ...args);