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

rename addEventListener and removeEventListener #6046

Merged
merged 1 commit into from Feb 6, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 10 additions & 10 deletions src/platforms/platform.dom.js
Expand Up @@ -124,11 +124,11 @@ var supportsEventListenerOptions = (function() {
// https://github.com/chartjs/Chart.js/issues/4287
var eventListenerOptions = supportsEventListenerOptions ? {passive: true} : false;

function addEventListener(node, type, listener) {
function addListener(node, type, listener) {
node.addEventListener(type, listener, eventListenerOptions);
}

function removeEventListener(node, type, listener) {
function removeListener(node, type, listener) {
node.removeEventListener(type, listener, eventListenerOptions);
}

Expand Down Expand Up @@ -223,8 +223,8 @@ function createResizer(handler) {
handler();
};

addEventListener(expand, 'scroll', onScroll.bind(expand, 'expand'));
addEventListener(shrink, 'scroll', onScroll.bind(shrink, 'shrink'));
addListener(expand, 'scroll', onScroll.bind(expand, 'expand'));
addListener(shrink, 'scroll', onScroll.bind(shrink, 'shrink'));

return resizer;
}
Expand All @@ -239,7 +239,7 @@ function watchForRender(node, handler) {
};

helpers.each(ANIMATION_START_EVENTS, function(type) {
addEventListener(node, type, proxy);
addListener(node, type, proxy);
});

// #4737: Chrome might skip the CSS animation when the CSS_RENDER_MONITOR class
Expand All @@ -258,7 +258,7 @@ function unwatchForRender(node) {

if (proxy) {
helpers.each(ANIMATION_START_EVENTS, function(type) {
removeEventListener(node, type, proxy);
removeListener(node, type, proxy);
});

delete expando.renderProxy;
Expand Down Expand Up @@ -429,7 +429,7 @@ module.exports = {
listener(fromNativeEvent(event, chart));
};

addEventListener(canvas, type, proxy);
addListener(canvas, type, proxy);
},

removeEventListener: function(chart, type, listener) {
Expand All @@ -447,7 +447,7 @@ module.exports = {
return;
}

removeEventListener(canvas, type, proxy);
removeListener(canvas, type, proxy);
}
};

Expand All @@ -462,7 +462,7 @@ module.exports = {
* @todo remove at version 3
* @private
*/
helpers.addEvent = addEventListener;
helpers.addEvent = addListener;

/**
* Provided for backward compatibility, use EventTarget.removeEventListener instead.
Expand All @@ -473,4 +473,4 @@ helpers.addEvent = addEventListener;
* @todo remove at version 3
* @private
*/
helpers.removeEvent = removeEventListener;
helpers.removeEvent = removeListener;