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:
parent
786505d6bc
commit
b8f32c0b1a
@ -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…
Reference in New Issue
Block a user