[docs] clear timeout on destroy

backported from https://github.com/sveltejs/learn.svelte.dev/pull/166
pull/8155/head
Simon H 2 years ago committed by GitHub
parent 786505d6bc
commit b8f32c0b1a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -18,6 +18,7 @@ export function longpress(node, duration) {
return {
destroy() {
clearTimeout(timer);
node.removeEventListener('mousedown', handleMousedown);
node.removeEventListener('mouseup', handleMouseup);
}

@ -21,6 +21,7 @@ export function longpress(node, duration) {
duration = newDuration;
},
destroy() {
clearTimeout(timer);
node.removeEventListener('mousedown', handleMousedown);
node.removeEventListener('mouseup', handleMouseup);
}

Loading…
Cancel
Save