how to check user is active on page in Angular 2 -
how can check mouse , key events in angular 2 globally, meant @ root level. want call 1 service when user interacting not idle application. please me , suggest solution on this.
in top level component, create observable event of document object , invoke service, example:
import 'rxjs/add/observable/fromevent'; import {observable} "rxjs/observable"; ... const clicks$ = observable.fromevent(document, 'click'); clicks$.subscribe(x => console.log('calling service here'));
Comments
Post a Comment