本文整理匯總了TypeScript中rxjs.Notification.createError方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Notification.createError方法的具體用法?TypeScript Notification.createError怎麽用?TypeScript Notification.createError使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類rxjs.Notification
的用法示例。
在下文中一共展示了Notification.createError方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: it
it('should materialize stream throws', () => {
const e1 = cold('#');
const e1subs = '(^!)';
const expected = '(x|)';
expectObservable(e1.pipe(materialize())).toBe(expected, { x: Notification.createError('error') });
expectSubscriptions(e1.subscriptions).toBe(e1subs);
});
示例2: it
it('should dematerialize stream throws', () => {
const error = 'error';
const e1 = hot('(x|)', {x: Notification.createError(error)});
const e1subs = '(^!)';
const expected = '#';
expectObservable(e1.pipe(dematerialize())).toBe(expected, null, error);
expectSubscriptions(e1.subscriptions).toBe(e1subs);
});
示例3: dematerialize1
dematerialize1() {
// emit next and error notifications
const source = from([
Notification.createNext('SUCCESS!'),
Notification.createError('ERROR!')
]).pipe(
// turn notification objects into notification values
dematerialize()
);
// output: 'NEXT VALUE: SUCCESS' 'ERROR VALUE: 'ERROR!'
const subscription = source.subscribe({
next: val => console.log(`NEXT VALUE: ${val}`),
error: val => console.log(`ERROR VALUE: ${val}`)
});
}