-
Notifications
You must be signed in to change notification settings - Fork 3k
/
config.ts
41 lines (38 loc) · 1.89 KB
/
config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import { Subscriber } from './Observable.js';
import { ObservableNotification } from './types.js';
/**
* The {@link GlobalConfig} object for RxJS. It is used to configure things
* like how to react on unhandled errors.
*/
export const config: GlobalConfig = {
onUnhandledError: null,
onStoppedNotification: null,
};
/**
* The global configuration object for RxJS, used to configure things
* like how to react on unhandled errors. Accessible via {@link config}
* object.
*/
export interface GlobalConfig {
/**
* A registration point for unhandled errors from RxJS. These are errors that
* cannot were not handled by consuming code in the usual subscription path. For
* example, if you have this configured, and you subscribe to an observable without
* providing an error handler, errors from that subscription will end up here. This
* will _always_ be called asynchronously on another job in the runtime. This is because
* we do not want errors thrown in this user-configured handler to interfere with the
* behavior of the library.
*/
onUnhandledError: ((err: any) => void) | null;
/**
* A registration point for notifications that cannot be sent to subscribers because they
* have completed, errored or have been explicitly unsubscribed. By default, next, complete
* and error notifications sent to stopped subscribers are noops. However, sometimes callers
* might want a different behavior. For example, with sources that attempt to report errors
* to stopped subscribers, a caller can configure RxJS to throw an unhandled error instead.
* This will _always_ be called asynchronously on another job in the runtime. This is because
* we do not want errors thrown in this user-configured handler to interfere with the
* behavior of the library.
*/
onStoppedNotification: ((notification: ObservableNotification<any>, subscriber: Subscriber<any>) => void) | null;
}