src/client/app/modules/puzzle/components/base.component.ts
Properties |
Methods |
|
constructor()
|
Protected clearSubscriptions |
clearSubscriptions()
|
Returns :
void
|
Protected consoleLogMsg |
consoleLogMsg(tag: string, msg: string)
|
Returns :
void
|
Protected handleErrors |
handleErrors(error: any)
|
Returns :
any
|
ngOnDestroy |
ngOnDestroy()
|
Returns :
void
|
subscriptions |
subscriptions:
|
Type : Array<ISubscription>
|
import {OnDestroy} from '@angular/core';
import {ISubscription} from 'rxjs/Subscription';
import {PuzzleConfig} from '../common/index';
export class BaseComponent implements OnDestroy {
subscriptions: Array<ISubscription>;
constructor() {
this.subscriptions = [];
}
ngOnDestroy() {
this.clearSubscriptions();
}
protected clearSubscriptions(): void {
this.subscriptions.map((subscription: ISubscription) => {
subscription.unsubscribe();
});
this.subscriptions = [];
}
protected handleErrors(error: any): any {
this.consoleLogMsg('ERROR', error);
}
protected consoleLogMsg(tag: string, msg: string): void {
if (PuzzleConfig.isDev === true) {
console.log(tag + ': ' + msg);
}
}
}