Skip to content

Commit

Permalink
chore(gesture): fix gestureMap type
Browse files Browse the repository at this point in the history
  • Loading branch information
straker committed Nov 28, 2021
1 parent 13cc10b commit d028625
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/gesture.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ let init = false;
* // handle panleft gesture
* });
* ```
* @property {{touches: number, touchstart?: Function, touchmove?: Function, touchend?: Function, [prop: string]: any}} gestureMap
* @property {{[name: string]: {touches: number, touchstart?: Function, touchmove?: Function, touchend?: Function, [prop: string]: any}}} gestureMap
*/
export let gestureMap = {
swipe: {
Expand Down
18 changes: 18 additions & 0 deletions test/typings/gesture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,24 @@ kontra.gestureMap.pan = {
console.log('touchend');
}
};
kontra.gestureMap.foo = {
touches: 2,
touchstart(touches: object) {
console.log('touchstart');
}
}
kontra.gestureMap.bar = {
touches: 2,
touchmove(touches: object) {
console.log('touchmove');
}
}
kontra.gestureMap.baz = {
touches: 2,
touchend(touches: object) {
console.log('touchend');
}
}

kontra.onGesture('panleft', (evt: TouchEvent, touches: object) => {
console.log('panleft');
Expand Down

0 comments on commit d028625

Please sign in to comment.