1515// Based on https://medium.com/madewithply/ionic-4-long-press-gestures-96cf1e44098b
1616
1717import { Directive , ElementRef , OnInit , OnDestroy , Output , EventEmitter } from '@angular/core' ;
18- import { Gesture } from '@ionic/angular' ;
18+ import { Gesture , GestureDetail } from '@ionic/angular' ;
1919import { GestureController } from '@singletons' ;
20+
2021/**
2122 * Directive to add long press actions to html elements.
2223 */
@@ -25,13 +26,13 @@ import { GestureController } from '@singletons';
2526} )
2627export class CoreLongPressDirective implements OnInit , OnDestroy {
2728
28- readonly HOLD_DURATION = 500 ;
29+ protected static readonly HOLD_DURATION = 500 ;
2930
3031 element : HTMLElement ;
3132 pressGesture ?: Gesture ;
3233 timeout ?: number ;
3334
34- @Output ( ) longPress = new EventEmitter ( ) ;
35+ @Output ( ) longPress = new EventEmitter < GestureDetail > ( ) ;
3536
3637 constructor ( el : ElementRef ) {
3738 this . element = el . nativeElement ;
@@ -52,7 +53,7 @@ export class CoreLongPressDirective implements OnInit, OnDestroy {
5253 this . longPress . emit ( event ) ;
5354
5455 delete this . timeout ;
55- } , this . HOLD_DURATION ) ;
56+ } , CoreLongPressDirective . HOLD_DURATION ) ;
5657 } ,
5758 onMove : ( ) => this . clearTimeout ( ) ,
5859 onEnd : ( ) => this . clearTimeout ( ) ,
0 commit comments