Skip to content

Commit

Permalink
fix(notifier-container): Setup notifier-container as early as possible (
Browse files Browse the repository at this point in the history
#144)

- Setup `notifier-container` component within `constructor` instead of `ngOnInit` lifecycle hook

Closes #119.
  • Loading branch information
dominique-mueller authored Oct 20, 2019
1 parent f838719 commit 17b5953
Showing 1 changed file with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnDestroy, OnInit } from '@angular/core';
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnDestroy } from '@angular/core';

import { Subscription } from 'rxjs';

Expand Down Expand Up @@ -30,7 +30,7 @@ import { NotifierNotificationComponent } from './notifier-notification.component
selector: 'notifier-container',
templateUrl: './notifier-container.component.html'
} )
export class NotifierContainerComponent implements OnDestroy, OnInit {
export class NotifierContainerComponent implements OnDestroy {

/**
* List of currently somewhat active notifications
Expand Down Expand Up @@ -74,17 +74,14 @@ export class NotifierContainerComponent implements OnDestroy, OnInit {
this.queueService = notifierQueueService;
this.config = notifierService.getConfig();
this.notifications = [];
}

/**
* Component initialization lifecycle hook, connects this component to the action queue, and then handles incoming actions
*/
public ngOnInit(): void {
// Connects this component up to the action queue, then handle incoming actions
this.queueServiceSubscription = this.queueService.actionStream.subscribe( ( action: NotifierAction ) => {
this.handleAction( action ).then( () => {
this.queueService.continue();
} );
} );

}

/**
Expand Down

0 comments on commit 17b5953

Please sign in to comment.