Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exposing error event data to directive output #127

Merged
merged 1 commit into from
Apr 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion projects/ngx-mapbox-gl/src/lib/map/map.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,7 @@ export class MapService {
this.mapInstance.on('render', () => this.zone.run(() => events.render.emit()));
}
if (events.error.observers.length) {
this.mapInstance.on('error', () => this.zone.run(() => events.error.emit()));
this.mapInstance.on('error', (evt: MapboxGl.ErrorEvent) => this.zone.run(() => events.error.emit(evt)));
}
if (events.data.observers.length) {
this.mapInstance.on('data', (evt: MapboxGl.EventData) => this.zone.run(() => events.data.emit(evt)));
Expand Down
4 changes: 2 additions & 2 deletions projects/ngx-mapbox-gl/src/lib/map/map.types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Can't use MapEvent interface from @types/mapbox because some event name are changed (eg zoomChange)
import { EventEmitter } from '@angular/core';
import { MapMouseEvent, MapTouchEvent, EventData, MapBoxZoomEvent, Map } from 'mapbox-gl';
import { MapMouseEvent, MapTouchEvent, EventData, MapBoxZoomEvent, Map, ErrorEvent } from 'mapbox-gl';
import { Results, Result } from '../control/geocoder-control.directive';

export interface MapEvent {
Expand Down Expand Up @@ -43,7 +43,7 @@ export interface MapEvent {
webGlContextRestored: EventEmitter<void>;
load: EventEmitter<Map>;
render: EventEmitter<void>;
error: EventEmitter<any>; // TODO Check type
error: EventEmitter<ErrorEvent>; // TODO Check type
data: EventEmitter<EventData>;
styleData: EventEmitter<EventData>;
sourceData: EventEmitter<EventData>;
Expand Down