Remove debug info (#1151)
This commit is contained in:
parent
51b893d4df
commit
9967724a80
@ -8,16 +8,13 @@ type HistoryBackFunction = ((event: PopStateEvent, noAnimation: boolean, previou
|
|||||||
|
|
||||||
// Carefully selected by swiping and observing visual changes
|
// Carefully selected by swiping and observing visual changes
|
||||||
// TODO: may be different on other devices such as iPad, maybe take dpi into account?
|
// TODO: may be different on other devices such as iPad, maybe take dpi into account?
|
||||||
const SAFARI_EDGE_BACK_GESTURE_LIMIT = 200;
|
const SAFARI_EDGE_BACK_GESTURE_LIMIT = 60;
|
||||||
const SAFARI_EDGE_BACK_GESTURE_DURATION = 200;
|
const SAFARI_EDGE_BACK_GESTURE_DURATION = 200;
|
||||||
let isEdge = false;
|
let isEdge = false;
|
||||||
|
|
||||||
const onTouchStart = (event: TouchEvent) => {
|
const onTouchStart = (event: TouchEvent) => {
|
||||||
const x = event.touches[0].pageX;
|
const x = event.touches[0].pageX;
|
||||||
|
|
||||||
// eslint-disable-next-line no-console
|
|
||||||
console.log('starting touch from', x);
|
|
||||||
|
|
||||||
if (x <= SAFARI_EDGE_BACK_GESTURE_LIMIT || x >= window.innerWidth - SAFARI_EDGE_BACK_GESTURE_LIMIT) {
|
if (x <= SAFARI_EDGE_BACK_GESTURE_LIMIT || x >= window.innerWidth - SAFARI_EDGE_BACK_GESTURE_LIMIT) {
|
||||||
isEdge = true;
|
isEdge = true;
|
||||||
}
|
}
|
||||||
@ -25,11 +22,7 @@ const onTouchStart = (event: TouchEvent) => {
|
|||||||
|
|
||||||
const onTouchEnd = () => {
|
const onTouchEnd = () => {
|
||||||
if (isEdge) {
|
if (isEdge) {
|
||||||
// eslint-disable-next-line no-console
|
|
||||||
console.log('touchend');
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
// eslint-disable-next-line no-console
|
|
||||||
console.log('setting isEdge to false');
|
|
||||||
isEdge = false;
|
isEdge = false;
|
||||||
}, SAFARI_EDGE_BACK_GESTURE_DURATION);
|
}, SAFARI_EDGE_BACK_GESTURE_DURATION);
|
||||||
}
|
}
|
||||||
@ -44,8 +37,6 @@ if (IS_IOS) {
|
|||||||
|
|
||||||
export default function useHistoryBack(handler: NoneToVoidFunction | HistoryBackFunction) {
|
export default function useHistoryBack(handler: NoneToVoidFunction | HistoryBackFunction) {
|
||||||
const onPopState = (event: PopStateEvent) => {
|
const onPopState = (event: PopStateEvent) => {
|
||||||
// eslint-disable-next-line no-console
|
|
||||||
console.log('onPopState, isEdge = ', isEdge, 'isHistoryChangedByUser = ', HistoryWrapper.isHistoryChangedByUser);
|
|
||||||
// Check if the event was caused by History API call or the user
|
// Check if the event was caused by History API call or the user
|
||||||
if (!HistoryWrapper.isHistoryChangedByUser) {
|
if (!HistoryWrapper.isHistoryChangedByUser) {
|
||||||
// HACK: Handle multiple event listeners.
|
// HACK: Handle multiple event listeners.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user