UNPKG

para-bridge-demo

Version:

a bridge api for js-ios/andriod rest

21 lines (19 loc) 731 B
import UnTouchableService from '../../untouchable/untouchable-service'; const touchService = new UnTouchableService(); console.log('register document touchmove events.'); const { handleTouchStart, handleTouchMove } = touchService; let hasLocked = false; export const lockTouchEvent = () => { if (hasLocked === false) { document.addEventListener('touchstart', handleTouchStart, false); document.addEventListener('touchmove', handleTouchMove, false); hasLocked = true; } }; export const unlockTouchEvent = () => { if (hasLocked === true) { document.removeEventListener('touchstart', handleTouchStart, false); document.removeEventListener('touchmove', handleTouchMove, false); hasLocked = false; } };