0.0.1 • Published 3 years ago

ngx-ionic-long-press v0.0.1

Weekly downloads
-
License
Apache 2.0
Repository
github
Last release
3 years ago

ngx-long-press

About

A IONIC gesture feature, for long press events

Instalation

 npm i ngx-long-press --save

Usage

app.module.ts

import { NgxLongPressModule } from 'ngx-long-press';

@NgModule({
  imports: [
    NgxLongPressModule
  ]
})
export class AppModule {}

add the directive [long-press] and the event callback (didLongPress) to the element you want to listen.

if you want a diferent duration for the press, pass the value as miliseconds on [presss-duration], default = 1500

app.component.html

    <ion-toolbar>
        <ion-title size="large" [long-press] (didLongPress)="alertLongPress()">Blank</ion-title>
    </ion-toolbar>

app.component.ts

export class AppComponent {
  constructor() {}
  public alertLongPress(){
      console.log("user did long press for 1500 ms")
  }
}

Properties

NameDescriptionTypedefault
(didLongPress)Emitted when a long-press is capturated.()=>Void
[presss-duration]Minimal duration for the press to countnumberdefault = 1500