From 060e1c304be0587fcdd6b19043d38a5fc047091e Mon Sep 17 00:00:00 2001 From: Will Eastcott Date: Fri, 21 Jun 2024 12:08:47 +0100 Subject: [PATCH] Remove events.attach (#6741) --- src/core/events.js | 34 ---------------------------------- src/framework/script.js | 4 ---- src/index.js | 1 - 3 files changed, 39 deletions(-) delete mode 100644 src/core/events.js diff --git a/src/core/events.js b/src/core/events.js deleted file mode 100644 index 81ff3ae9855..00000000000 --- a/src/core/events.js +++ /dev/null @@ -1,34 +0,0 @@ -import { EventHandler } from './event-handler.js'; - -const events = { - /** - * Attach event methods 'on', 'off', 'fire', 'once' and 'hasEvent' to the target object. - * - * @param {object} target - The object to add events to. - * @returns {object} The target object. - * @example - * const obj = { }; - * pc.events.attach(obj); - * @ignore - */ - attach(target) { - const ev = events; - target._addCallback = ev._addCallback; - target.on = ev.on; - target.off = ev.off; - target.fire = ev.fire; - target.once = ev.once; - target.hasEvent = ev.hasEvent; - EventHandler.prototype.initEventHandler.call(target); - return target; - }, - - _addCallback: EventHandler.prototype._addCallback, - on: EventHandler.prototype.on, - off: EventHandler.prototype.off, - fire: EventHandler.prototype.fire, - once: EventHandler.prototype.once, - hasEvent: EventHandler.prototype.hasEvent -}; - -export { events }; diff --git a/src/framework/script.js b/src/framework/script.js index 86f7bf6bd9d..488e49e231c 100644 --- a/src/framework/script.js +++ b/src/framework/script.js @@ -1,5 +1,3 @@ -import { events } from '../core/events.js'; - import { getApplication } from './globals.js'; /** @@ -62,6 +60,4 @@ const script = { } }; -events.attach(script); - export { script }; diff --git a/src/index.js b/src/index.js index b8e9840c013..7e0878a8ad1 100644 --- a/src/index.js +++ b/src/index.js @@ -27,7 +27,6 @@ import './polyfill/typedarray-fill.js'; // CORE export * from './core/constants.js'; export { apps, common, config, data, extend, revision, type, version } from './core/core.js'; -export { events } from './core/events.js'; export { guid } from './core/guid.js'; export { path } from './core/path.js'; export { platform } from './core/platform.js';