aurelia-long-click-event
aurelia plugin for long-click event.
How to Use
install the plugin using yarn
or npm
.
yarn add aurelia-long-click-event
npm install aurelia-long-click-event
initialize the plugin in your main.js
or main.ts
.
import { PLATFORM } from "aurelia-pal";
aurelia.use
.standardConfiguration()
.developmentLogging()
+ .plugin(PLATFORM.moduleName("aurelia-long-click-event"));
you can pass optional configuration to control the name of the long-click event (defaults to "long-click"), and the click duration (defaults to 500 ms).
import { LongClickConfig } from "aurelia-long-click-event"; // (TS users can use this interface for strongly typed config)
...
.plugin(PLATFORM.moduleName("aurelia-long-click-event"), { longClickEventName: "long-click", clickDurationMS: 500 });
now you can register callbacks to the event just like any regular event (using trigger
or delegate
)
<button long-click.delegate="longClick()">long click me</button>
plugin was build using:
- https://github.com/john-doherty/long-press-event
- https://github.com/aurelia-toolbelt/aurelia-plugin-skeleton-typescript
How to build and run sample
-
npm run watch
- Launches sample and watches src folder
- it does the type-checking and ts-lints on every save
- open
http://localhost:4444
to see the plugin in action.
-
npm run build
- Produces amd/commonjs/system/es2015 builds
- This will NOT emit/update files if you have any typescript or tslint errors
I Need help regarding how to test the plugin - PR welcome