ngx-joyride
Version:
[](https://badge.fury.io/js/ngx-joyride) [](https://travis-ci.org/tnicola/ngx-joyride) [ {
this.rendererFactory = rendererFactory;
this.DOMService = DOMService;
this.scrollEvent = new Subject();
this.resizeEvent = new Subject();
this.renderer = rendererFactory.createRenderer(null, null);
}
startListeningScrollEvents() {
this.scrollUnlisten = this.renderer.listen('document', 'scroll', evt => {
this.scrollEvent.next({
scrollX: this.DOMService.getNativeWindow().pageXOffset,
scrollY: this.DOMService.getNativeWindow().pageYOffset
});
});
}
startListeningResizeEvents() {
this.resizeUnlisten = this.renderer.listen('window', 'resize', evt => {
this.resizeEvent.next(evt);
});
}
stopListeningScrollEvents() {
this.scrollUnlisten();
}
stopListeningResizeEvents() {
this.resizeUnlisten();
}
}
EventListenerService.decorators = [
{ type: Injectable }
];
EventListenerService.ctorParameters = () => [
{ type: RendererFactory2 },
{ type: DomRefService }
];
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXZlbnQtbGlzdGVuZXIuc2VydmljZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL3Byb2plY3RzL25neC1qb3lyaWRlL3NyYy9saWIvc2VydmljZXMvZXZlbnQtbGlzdGVuZXIuc2VydmljZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsVUFBVSxFQUFhLGdCQUFnQixFQUFFLE1BQU0sZUFBZSxDQUFDO0FBQ3hFLE9BQU8sRUFBRSxPQUFPLEVBQUUsTUFBTSxNQUFNLENBQUM7QUFDL0IsT0FBTyxFQUFFLGFBQWEsRUFBRSxNQUFNLGVBQWUsQ0FBQztBQUU5QyxNQUFNLE9BQU8sTUFBTTtDQUdsQjtBQUdELE1BQU0sT0FBTyxvQkFBb0I7SUFRN0IsWUFBNkIsZUFBaUMsRUFBbUIsVUFBeUI7UUFBN0Usb0JBQWUsR0FBZixlQUFlLENBQWtC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