Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

ngx-long-press2

anthonynahas1.5kMIT16.1.0TypeScript support: included

Angular Library to handle long mouse clicks event for desktop and long touch events for mobile and tablets

ng, ngx, library, angular, long press, long pressing, long click, long touch, action mode, ssr

readme

angular-material-extensions's logo

ngx-long-press2 - Angular Library to handle long mouse clicks event for desktop and long touch events for mobile and tablets

npm version npm demo docs: typedoc Join the chat at https://gitter.im/angular-material-extensions/Lobby

@angular-material-extensions/select-country demonstration

Built by and for developers :heart:

Do you have any question or suggestion ? Please do not hesitate to contact us! Alternatively, provide a PR | open an appropriate issue here

If you like this project, support angular-material-extensions by starring :star: and sharing it :loudspeaker:

Table of Contents

Demo

View all the directives and components in action at https://anthonynahass.github.io/ngx-long-press2

Library's directive

  • ngxLongPress2

Dependencies

  • Angular developed and tested with 16.x

Installation

Install via npm.

Install peer dependencies

npm i -s ngx-long-press2

Import the library

import { NgxLongPress2Module } from 'ngx-long-press2'; 

@NgModule({
  declarations: [AppComponent, ...],
  imports: [NgxLongPress2Module, ...],  
  bootstrap: [AppComponent]
})
export class AppModule {
}

Other modules in your application like for lazy loading import NgxLongPress2Module into your feature module:

API

option bind type default description
minTime Input() number 500 the minimum time to fire onLongPress event (in ms)
maxTime Input() number 2000 the maximum time to fire onReleasePressing event (in ms)
onLongPress Output() EventEmitter<void> - emits when the minTime is exceeded
onLongPressing Output() EventEmitter<number> - emits when the user is pressing and the time lapsed in ms will be emitted
onReleasePressing Output() EventEmitter<void> - emits when the maxTime is exceeded or touchend, mouseup and mouseleave haven been emitted

Usage

  <button mat-raised-button
          ngxLongPress2
          [color]="this.timeLapsed1 > 1000? 'primary' : 'warn'"
          (onLongPress)="onLongPress()"
          (onLongPressing)="onLongPressing($event)"
          (onReleasePressing)="onReleasePressing()">
  {{ this.timeLapsed1 > 0 ? this.timeLapsed1 + ' ms' : 'PRESS ME'}}
</button>

@angular-material-extensions/select-country demonstration

<button ngxLongPress2></button>

images

Run Demo App Locally after cloning the github project

Build the library

$ npm run build:lib

Serve the demo app

$ npm start

Other Angular Libraries


Support



Who is using ngx-long-press2? Awesome apps?

  1. Nahaus.de

Are you missing your project or you app? PR me to publish it on the README


jetbrains logo

This project is supported by jetbrains with 1 ALL PRODUCTS PACK OS LICENSE incl. webstorm


License

Copyright (c) 2023 Anthony Nahas. Licensed under the MIT License (MIT)

angular-material-extensions's logo

changelog

5.0.0 (2023-06-15)

Bug Fixes

  • project: minor (b71be01)
  • project: minor (139a582)
  • project: minor (6703a2e)
  • project: readme updated (5f3ba36)
  • project: upgraded angular core and cli to v16 (09e9675)
  • project: upgraded angular material (621265d)
  • project: upgraded angular universal (b135992)

4.0.1 (2023-02-21)

Bug Fixes

4.0.0 (2023-02-21)

Bug Fixes

  • docs: minor (9ee05e5)
  • project: updated the readme (1765b3f)
  • project: updated the readme (d833bd7)
  • project: upgraded material to v15 (a45708f)
  • project: upgraded ng to v15 (099f940)
  • project: upgraded universal to v15 (9833bc5)

3.0.0 (2022-06-21)

Bug Fixes

  • project: updated dependencies (3a1b6fe)
  • project: updated peer dependencies (a1a5523)
  • project: updated peer dependencies (18b44e2)
  • project: upgraded angular universal (a71a2a4)
  • project: upgraded to angular material v14 (f41d94e)
  • project: upgraded to angular material v14 (8ad3632)
  • project: upgraded to angular v11 (05aea70)
  • project: upgraded to angular v14 (f0b7703)

2.0.0 (2022-01-11)

Bug Fixes

  • project: updated the deps (6e7ea4a)
  • project: updated the deps (aa11217)
  • project: upgraded (32ae8ac)
  • project: upgraded (a547b65)
  • project: upgraded angular to v12 (e8ab4d0)
  • project: upgraded angular to v12 (43df47a)
  • project: upgraded angular to v13 (5b2fb8a)
  • project: upgraded angular to v13 (2541667)
  • project: upgraded express engine (eab9008)
  • project: upgraded express engine (822c73f)
  • project: upgraded the project to angular material to v11 (05e9a72)
  • project: upgraded the project to angular material to v11 (37d9f20)
  • project: upgraded the project to angular v11 (72b85be)

1.0.0 (2020-10-02)

Bug Fixes

  • demo: added flex layout (0cfee04)
  • demo: enhanced and improved the demo app (ea2d715)
  • demo: improved the demo app (3123988)
  • lib: updated the package.json file (b0b1224)
  • project: minor (fd7ab31)

Features

  • lib: generated the library (f468d83)
  • lib: implemented ngxLongPress2's directive (7b5e5ad)
  • project: added angular material to the demo app (d296be4)
  • project: added angular-cli-ghpages (2662bd4)
  • project: added compo doc to the project (42c1e5c)
  • project: added universal support and releast it packages (8fb1848)