Skip to content

Commit

Permalink
allow multiple targets to be used
Browse files Browse the repository at this point in the history
  • Loading branch information
scttcper committed Aug 22, 2016
1 parent 357048d commit 868529e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/components/toastr/overlay/overlay-container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class OverlayContainer {
*/
private _createContainer(): void {
let container = document.createElement('div');
container.classList.add('toast-container-container');
container.classList.add('overlay-container');
document.body.appendChild(container);
this._containerElement = container;
}
Expand Down
12 changes: 4 additions & 8 deletions src/components/toastr/overlay/overlay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { OverlayContainer } from './overlay-container';
*/
@Injectable()
export class Overlay {
private _paneElement: HTMLElement;
private _paneElement: {string?: HTMLElement} = {};
constructor(private _overlayContainer: OverlayContainer,
private _componentFactoryResolver: ComponentFactoryResolver) {}
/**
Expand All @@ -28,14 +28,10 @@ export class Overlay {
}

getPaneElement(positionClass: string): HTMLElement {
if (!this._paneElement) {
if (!this._paneElement[positionClass]) {
this._createPaneElement(positionClass);
}
return this._paneElement;
}

dispose() {
this._paneElement = null;
return this._paneElement[positionClass];
}

/**
Expand All @@ -47,7 +43,7 @@ export class Overlay {
pane.id = 'toast-container';
pane.classList.add(positionClass);
this._overlayContainer.getContainerElement().appendChild(pane);
this._paneElement = pane;
this._paneElement[positionClass] = pane;
return pane;
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/toastr/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "toastr-ng2",
"version": "1.0.0",
"version": "1.1.0",
"description": "Toastr for Angular 2",
"main": "./toastr.js",
"typings": "./toastr.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion src/components/toastr/toastr-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export class ToastrService {
});
}
if (!this.toasts.length) {
this.overlay.dispose();
// this.overlay.dispose();
activeToast.overlayRef.dispose();
}
return true;
Expand Down

0 comments on commit 868529e

Please sign in to comment.