finished re-implementation of test example in Typescript
added some code to detect swipe direction