1.0.2 • Published 2 years ago

ag-swipe-core v1.0.2

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

For more details on the public interface of the library please see the Github page.

Installation

npm install ag-swipe-core --save

Usage

import { createSwipeSubscription, SwipeEvent } from 'ag-swipe-core';

const domElement: HTMLElement = document.querySelector('#swipe-element');

const swipeSubscription = createSwipeSubscription({
  domElement,
  onSwipeEnd: (event: SwipeEvent) => {
    console.log(`SwipeEnd direction: ${event.direction} and distance: ${event.distance}`);
  },
});

Unsubscribing

When swipe events should no longer be tracked:

if (swipeSubscription) {
  swipeSubscription.unsubscribe();
}
1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago