ag-swipe-core
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

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();
}

Package Sidebar

Install

npm i ag-swipe-core

Weekly Downloads

569

Version

1.0.2

License

ISC

Unpacked Size

3.67 kB

Total Files

6

Last publish

Collaborators

  • agoncharuks