Skip to content

Commit

Permalink
feat(core): define SwipeCallback and SwipeConfig types
Browse files Browse the repository at this point in the history
Introduced the SwipeCallback type to handle swipe events and the SwipeConfig type to configure swipe behavior in the swiperia-core package. These types will facilitate customized swipe handling and configuration, enhancing the library's flexibility and usability.
  • Loading branch information
samavati committed Apr 13, 2024
1 parent ad06a8d commit 8c37af5
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/swiperia-core/src/lib/types/SwipeCallback.type.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import type { SwipeEvent } from '../event/SwipeEvent.type';

export type SwipeCallback = (event: SwipeEvent) => void;
14 changes: 14 additions & 0 deletions packages/swiperia-core/src/lib/types/SwipeConfig.type.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export type SwipeConfig = {
/**
* required min distance(px) traveled to be considered swipe
*/
threshold?: number;
/**
* prevents scroll during swipe
*/
preventScrollOnSwipe?: boolean;
/**
* maximum time(ms) allowed to travel that distance
*/
allowedTime?: number;
};
2 changes: 2 additions & 0 deletions packages/swiperia-core/src/lib/types/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export type { SwipeConfig } from './SwipeConfig.type';
export type { SwipeCallback } from './SwipeCallback.type';

0 comments on commit 8c37af5

Please sign in to comment.