Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate unused evented utility #3125

Merged
merged 7 commits into from
Oct 31, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions js/src/common/utils/evented.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/**
* The `evented` mixin provides methods allowing an object to trigger events,
* running externally registered event handlers.
*
* @deprecated
fredden marked this conversation as resolved.
Show resolved Hide resolved
*/
export default {
/**
Expand All @@ -19,6 +21,8 @@ export default {
* @protected
*/
getHandlers(event) {
console.trace('evented is deprecated and will be removed in a future version');

this.handlers = this.handlers || {};

this.handlers[event] = this.handlers[event] || [];
Expand All @@ -34,6 +38,8 @@ export default {
* @public
*/
trigger(event, ...args) {
console.trace('evented is deprecated and will be removed in a future version');

this.getHandlers(event).forEach((handler) => handler.apply(this, args));
},

Expand All @@ -44,6 +50,8 @@ export default {
* @param {function} handler The function to handle the event.
*/
on(event, handler) {
console.trace('evented is deprecated and will be removed in a future version');

this.getHandlers(event).push(handler);
},

Expand All @@ -55,6 +63,8 @@ export default {
* @param {function} handler The function to handle the event.
*/
one(event, handler) {
console.trace('evented is deprecated and will be removed in a future version');

const wrapper = function () {
handler.apply(this, arguments);

Expand All @@ -71,6 +81,8 @@ export default {
* @param {function} handler The function that handles the event.
*/
off(event, handler) {
console.trace('evented is deprecated and will be removed in a future version');

const handlers = this.getHandlers(event);
const index = handlers.indexOf(handler);

Expand Down