npm i --save nativescript-eventify
- 版本:1.0.1
- GitHub: https://github.com/mudlabs/nativescript-eventify
- NPM: https://npmjs.net.cn/package/nativescript-eventify
- 下载
- 昨天:0
- 上周:0
- 上个月:0
NativeScript Eventify
NativeScript 有一个名为 notify
的方法,您可以使用它来通知可观察对象的变化。但是您不能用它来触发像 tap
或 swipe
这样的事件,请进入 NativeScript Eventify。
支持的事件
tap
路线图
- 添加对
doubleTap
事件的支持 - 添加对
longPress
事件的支持 - 添加对
swipe
事件的支持 - 添加对
pan
事件的支持 - 添加对
pinch
事件的支持 - 添加对
rotate
事件的支持 - 添加对
touch
事件的支持
安装
tns plugin add nativescript-eventify
用法
只需引用一次。
//app.js
require("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 |