0
0
mirror of https://github.com/sveltejs/svelte.git synced 2024-12-01 17:30:59 +01:00

[docs] clear timeout on destroy

backported from https://github.com/sveltejs/learn.svelte.dev/pull/166
This commit is contained in:
Simon H 2022-12-22 17:47:52 +01:00 committed by GitHub
parent 786505d6bc
commit b8f32c0b1a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 0 deletions

View File

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

View File

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