本文整理汇总了TypeScript中toastr.warning函数的典型用法代码示例。如果您正苦于以下问题:TypeScript warning函数的具体用法?TypeScript warning怎么用?TypeScript warning使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了warning函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: switch
this.toastsPromise.then((toasts: IToast[]) => {
for (let t of toasts){
//Setup callbacks to track dismisal status
let overrides: ToastrOptions = {
onclick: () => {
ToastService.acknowledgeToast(t.Id, this.context.pageContext.web.id);
},
onCloseClick: () => {
ToastService.acknowledgeToast(t.Id, this.context.pageContext.web.id);
}
};
switch (t.Severity){
case 'Warning':
toastr.warning(t.Message, t.Title, overrides);
break;
case 'Error':
toastr.error(t.Message, t.Title, overrides);
break;
case 'Success':
toastr.success(t.Message, t.Title, overrides);
break;
default:
toastr.info(t.Message, t.Title, overrides);
break;
}
}
}).catch((error: any): void => {
示例2: add
add(): void {
if (this.form.valid) {
this.entryService.addEntry({ name: this.name });
this.name = '';
} else {
warning('You must enter a name');
}
}
示例3: handleError
private handleError (error: any) {
// In a real world app, we might send the error to remote logging infrastructure
let errMsg = error._body || 'Server error';
console.error(errMsg); // log to console instead
if (error.status >= 500) {
toastr.error('An error has occured. Please contact support for further assistance');
} else {
toastr.warning(errMsg);
}
return Observable.throw(errMsg);
}
示例4: warning
warning(message: string, title?: string) {
return toastr.warning(message, title);
}
示例5: warning
warning(msg:any, options:ToastrOptions = {}) {
toastr.warning(msg, options.title, options);
}
示例6: showWarning
function showWarning(message) {
toastr.warning(message);
}