tabby/app/src/services/notify.ts
Eugene Pankov d7bae654eb .
2016-12-26 23:21:50 +01:00

47 lines
957 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,
})
}
}