1.0.13 • Published 3 years ago
@oliverphaser/nativescript-eventify v1.0.13
NativeScript Eventify
NativeScript has a method called notify you can use to notify an observable of changes. But you can't use it to trigger events like tap or swipe, enter NativeScript Eventify.
NativeScript 8
This will work only on NativeScript 8.
Supported Events
tap
Roadmap
- Add support for
doubleTapevents - Add support for
longPressevents - Add support for
swipeevents - Add support for
panevents - Add support for
pinchevents - Add support for
rotateevents - Add support for
touchevents
Installation
ns plugin add @oliverphaser/nativescript-eventifyUsage
Just require it once.
//app.js
require("@oliverphaser/nativescript-eventify");/**
* home-page.js
*
* Assume the view already has the event listner(s) setup.
*/
// Simulates a tap event
view.eventify({ eventName: "tap", object: view });Take a look at this Playground for a working example.
API
| Properties | Required | Description |
|---|---|---|
| EventData | Yes | The eventName and object, just like using notify. |
| Info | Sometimes | Some of the events (i.e. swipe) will need extra information |
Info
| Event | Required | Properties | Description |
|---|---|---|---|
| tap | No | n/a | n/a |