Socket
Socket
Sign inDemoInstall

ionic-long-press

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ionic-long-press

A little plugin to add long-press events to ionic components


Version published
Maintainers
1
Created
Source

Ionic Long Press

Say you need to increment something quickly while pushing a button. Or something. This directive intends to build upon the existing Hammer.JS press event that Ionic uses for long pressing, by giving you interval emission.

Compatibility

This plugin should be compatible with Ionic and Angular 2+. It was tested with Ionic 3.5.0 and Angular 4.1.3, but the APIs have not changed since Angular 2 final. If this compatibility information is wrong, please open an issue.

Installation

npm install --save ionic-long-press

Usage

The directive should work on any HTML element.

Import the module:

import { LongPressModule } from 'ionic-long-press';

@NgModule({
    imports: [
        ...
        LongPressModule
        ...
    ]
})

And use in your template:

<button ion-button ion-long-press [interval]="400" (onPressStart)="pressed()" (onPressing)="active()" (onPressEnd)="released()"></button>

API

ItemDescription
ion-long-pressDirective to include the press event outputs.
[interval]Number. Allows you to set the interval at which the onPressing event will fire. Default 500.
(onPressStart)Event fired when the element is initially pressed.
(onPressing)Event fired on the specified interval when the element is being held.
(onPressEnd)Event fired when the element is released.

Caveats

I have instated a 40ms interval limit to prevent poor performance. I recommend a longer interval for heavy computations. If you need this limit lowered, please open an issue explaining your use case.

Credits

This plugin was developed by Wilson Hobbs in July 2017.

FAQs

Package last updated on 13 Jun 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc