tabby/terminus-core/src/services/notify.service.ts
Eugene Pankov 889a60ba3b lint
2017-05-01 13:35:26 +02:00

46 lines
962 B
TypeScript

import { Injectable } from '@angular/core'
import { ToasterService } from 'angular2-toaster'
@Injectable()
export class NotifyService {
constructor (
private toaster: ToasterService,
) {}
pop (options) {
this.toaster.pop(options)
}
info (title: string, body: string = null) {
return this.pop({
type: 'info',
title, body,
timeout: 4000,
})
}
success (title: string, body: string = null) {
return this.pop({
type: 'success',
title, body,
timeout: 4000,
})
}
warning (title: string, body: string = null) {
return this.pop({
type: 'warning',
title, body,
timeout: 4000,
})
}
error (title: string, body: string = null) {
return this.pop({
type: 'error',
title, body,
timeout: 4000,
})
}
}