From 79c1bba30b2ca52e39597f237bf71e91b36b6323 Mon Sep 17 00:00:00 2001 From: Miyuki Hanaoka Date: Tue, 30 Jan 2024 16:23:50 +0900 Subject: [PATCH] feat: add clearPolyfill --- src/index.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 01e50ba..fc5c767 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,4 +1,4 @@ -import { addDocumentListener, createDragImage, onEvt, Point } from "./internal/dom-utils"; +import { addDocumentListener, createDragImage, onEvt, Point, removeDocumentListener } from "./internal/dom-utils"; import { DragOperationController, DragOperationState } from "./internal/drag-operation-controller"; import { elementFromPoint, tryFindDraggableTarget } from "./internal/drag-utils"; import { detectFeatures } from "./internal/feature-detection"; @@ -232,4 +232,12 @@ export function polyfill( override?:Config ):boolean { return true; } +export function clearPolyfill(): void { + if( config.holdToDrag ) { + removeDocumentListener("touchstart", onDelayTouchstart); + } else { + removeDocumentListener("touchstart", onTouchstart); + } +} + //