Skip to content

Commit

Permalink
Merge pull request #629 from sveltejs/gh-621
Browse files Browse the repository at this point in the history
rename addEventListener and removeEventListener
  • Loading branch information
Rich-Harris authored Jun 11, 2017
2 parents d4153ed + b7ea045 commit 728594b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/generators/dom/visitors/Element/Binding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ export default function visitBinding(
}
${generator.helper(
'addEventListener'
'addListener'
)}( ${state.parentNode}, '${eventName}', ${handler} );
`);

Expand All @@ -178,19 +178,19 @@ export default function visitBinding(

block.builders.destroy.addLine(deindent`
${generator.helper(
'removeEventListener'
'removeListener'
)}( ${state.parentNode}, '${eventName}', ${handler} );
`);

if (attribute.name === 'paused') {
block.builders.create.addLine(
`${generator.helper(
'addEventListener'
'addListener'
)}( ${state.parentNode}, 'play', ${handler} );`
);
block.builders.destroy.addLine(
`${generator.helper(
'removeEventListener'
'removeListener'
)}( ${state.parentNode}, 'play', ${handler} );`
);
}
Expand Down
4 changes: 2 additions & 2 deletions src/generators/dom/visitors/Element/EventHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,13 @@ export default function visitEventHandler(
} else {
block.builders.create.addLine(deindent`
${generator.helper(
'addEventListener'
'addListener'
)}( ${state.parentNode}, '${name}', ${handlerName} );
`);

block.builders.destroy.addLine(deindent`
${generator.helper(
'removeEventListener'
'removeListener'
)}( ${state.parentNode}, '${name}', ${handlerName} );
`);
}
Expand Down
4 changes: 2 additions & 2 deletions src/shared/dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ export function createComment() {
return document.createComment('');
}

export function addEventListener(node, event, handler) {
export function addListener(node, event, handler) {
node.addEventListener(event, handler, false);
}

export function removeEventListener(node, event, handler) {
export function removeListener(node, event, handler) {
node.removeEventListener(event, handler, false);
}

Expand Down

0 comments on commit 728594b

Please sign in to comment.