copay-crown
Version:
A Secure Crown Wallet
39 lines (33 loc) • 880 B
text/typescript
import { Directive, ElementRef, EventEmitter, OnDestroy, OnInit, Output } from '@angular/core';
import { Gesture } from 'ionic-angular/gestures/gesture';
declare var Hammer: any;
import { ProfileProvider } from '../../providers/profile/profile';
({
selector: '[longPress]'
})
export class LongPress implements OnInit, OnDestroy {
el: HTMLElement;
pressGesture: Gesture;
()
longPress: EventEmitter<any> = new EventEmitter();
constructor(
el: ElementRef,
profileProvider: ProfileProvider
) {
this.el = el.nativeElement;
}
ngOnInit() {
this.pressGesture = new Gesture(this.el, {
recognizers: [
[Hammer.Press, { time: 1000 }]
]
});
this.pressGesture.listen();
this.pressGesture.on('press', e => {
this.longPress.emit(e);
})
}
ngOnDestroy() {
this.pressGesture.destroy();
}
}