@oliverphaser/nativescript-eventify
允许在NativeScript应用程序中程序化执行手势事件。从mudlabs分支出来,并针对NativeScript 8进行了更新。
npm i --save @oliverphaser/nativescript-eventify

npm apple android
support

NativeScript Eventify

NativeScript有一个名为notify的方法,您可以使用它来通知可观察对象的变化。但您不能使用它来触发像tapswipe这样的事件,这就是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