Skip to content

Commit

Permalink
feat(infoWindow): emit event when closed
Browse files Browse the repository at this point in the history
closes #306
closes #317
closes #360
  • Loading branch information
Alex Weber authored and sebholstein committed May 19, 2016
1 parent 7ba4fd4 commit 00f4f2d
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/directives/google-map-info-window.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Component, SimpleChange, OnDestroy, OnChanges, ElementRef} from '@angular/core';
import {Component, SimpleChange, OnDestroy, OnChanges, ElementRef, EventEmitter} from '@angular/core';
import {InfoWindowManager} from '../services/info-window-manager';
import {SebmGoogleMapMarker} from './google-map-marker';

Expand Down Expand Up @@ -36,6 +36,7 @@ let infoWindowId = 0;
@Component({
selector: 'sebm-google-map-info-window',
inputs: ['latitude', 'longitude', 'disableAutoPan'],
outputs: ['infoWindowClose'],
template: `<div class='sebm-google-map-info-window-content'>
<ng-content></ng-content>
</div>
Expand Down Expand Up @@ -86,6 +87,11 @@ export class SebmGoogleMapInfoWindow implements OnDestroy,
*/
content: Node;

/**
* Emits an event when the info window is closed.
*/
infoWindowClose: EventEmitter<void> = new EventEmitter<void>();

private static _infoWindowOptionsInputs: string[] = ['disableAutoPan', 'maxWidth'];
private _infoWindowAddedToManager: boolean = false;
private _id: string = (infoWindowId++).toString();
Expand Down Expand Up @@ -129,7 +135,9 @@ export class SebmGoogleMapInfoWindow implements OnDestroy,
/**
* Closes the info window.
*/
close(): Promise<void> { return this._infoWindowManager.close(this); }
close(): Promise<void> {
return this._infoWindowManager.close(this).then(() => { this.infoWindowClose.emit(void 0); });
}

/** @internal */
id(): string { return this._id; }
Expand Down

0 comments on commit 00f4f2d

Please sign in to comment.