@oliverphaser/nativescript-eventify
允许在NativeScript应用程序中程序化执行手势事件。从mudlabs分支出来,并针对NativeScript 8进行了更新。
npm i --save @oliverphaser/nativescript-eventify
- 版本:1.0.13
- GitHub: https://github.com/oliverphaser/nativescript-eventify
- NPM: https://npmjs.net.cn/package/%40oliverphaser%2Fnativescript-eventify
- 下载
- 前一天:0
- 上周:0
- 上个月:18
NativeScript Eventify
NativeScript有一个名为notify
的方法,您可以使用它来通知可观察对象的变化。但您不能使用它来触发像tap
或swipe
这样的事件,这就是NativeScript Eventify的用武之地。
NativeScript 8
这只能在NativeScript 8上工作。
支持的事件
tap
路线图
- 添加对
doubleTap
事件的支持 - 添加对
longPress
事件的支持 - 添加对
swipe
事件的支持 - 添加对
pan
事件的支持 - 添加对
pinch
事件的支持 - 添加对
rotate
事件的支持 - 添加对
touch
事件的支持
安装
ns plugin add @oliverphaser/nativescript-eventify
用法
只需引用一次。
//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 });
查看这个Playground以获取一个示例。
API
属性 | 必需 | 描述 |
---|---|---|
EventData | 是 | eventName和对象,就像使用notify 一样。 |
信息 | 有时 | 某些事件(例如swipe )可能需要额外信息 |
信息
事件 | 必需 | 属性 | 描述 |
---|---|---|---|
tap | 否 | n/a | n/a |