refractor: core module (#289)

* Shift services into their own folders.
* Add comments.

Fixes #288
This commit is contained in:
Abhay Chawla
2018-08-11 21:52:44 +05:30
committed by GitHub
parent 1526235e2b
commit 90087bf248
37 changed files with 1330 additions and 1136 deletions
+7
View File
@@ -0,0 +1,7 @@
/**
* Alert model.
*/
export interface Alert {
type: string;
message: string;
}
+15
View File
@@ -0,0 +1,15 @@
import { TestBed, inject } from '@angular/core/testing';
import { AlertService } from './alert.service';
describe('AlertService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
providers: [AlertService]
});
});
it('should be created', inject([AlertService], (service: AlertService) => {
expect(service).toBeTruthy();
}));
});
+33
View File
@@ -0,0 +1,33 @@
/** Angular Imports */
import { Injectable, EventEmitter } from '@angular/core';
/** Custom Model */
import { Alert } from './alert.model';
/**
* Alert service.
*/
@Injectable({
providedIn: 'root'
})
export class AlertService {
/** Alert event. */
public alertEvent: EventEmitter<Alert>;
/**
* Initializes alert event.
*/
constructor() {
this.alertEvent = new EventEmitter();
}
/**
* Emits an alert event.
* @param {Alert} alertEvent Alert event.
*/
alert(alertEvent: Alert) {
this.alertEvent.emit(alertEvent);
}
}