UNPKG

4.05 kBTypeScriptView Raw
1import { Subscriber } from './Subscriber';
2import { ObservableNotification } from './types';
3/**
4 * The {@link GlobalConfig} object for RxJS. It is used to configure things
5 * like how to react on unhandled errors.
6 */
7export declare const config: GlobalConfig;
8/**
9 * The global configuration object for RxJS, used to configure things
10 * like how to react on unhandled errors. Accessible via {@link config}
11 * object.
12 */
13export interface GlobalConfig {
14 /**
15 * A registration point for unhandled errors from RxJS. These are errors that
16 * cannot were not handled by consuming code in the usual subscription path. For
17 * example, if you have this configured, and you subscribe to an observable without
18 * providing an error handler, errors from that subscription will end up here. This
19 * will _always_ be called asynchronously on another job in the runtime. This is because
20 * we do not want errors thrown in this user-configured handler to interfere with the
21 * behavior of the library.
22 */
23 onUnhandledError: ((err: any) => void) | null;
24 /**
25 * A registration point for notifications that cannot be sent to subscribers because they
26 * have completed, errored or have been explicitly unsubscribed. By default, next, complete
27 * and error notifications sent to stopped subscribers are noops. However, sometimes callers
28 * might want a different behavior. For example, with sources that attempt to report errors
29 * to stopped subscribers, a caller can configure RxJS to throw an unhandled error instead.
30 * This will _always_ be called asynchronously on another job in the runtime. This is because
31 * we do not want errors thrown in this user-configured handler to interfere with the
32 * behavior of the library.
33 */
34 onStoppedNotification: ((notification: ObservableNotification<any>, subscriber: Subscriber<any>) => void) | null;
35 /**
36 * The promise constructor used by default for {@link Observable#toPromise toPromise} and {@link Observable#forEach forEach}
37 * methods.
38 *
39 * @deprecated As of version 8, RxJS will no longer support this sort of injection of a
40 * Promise constructor. If you need a Promise implementation other than native promises,
41 * please polyfill/patch Promise as you see appropriate. Will be removed in v8.
42 */
43 Promise?: PromiseConstructorLike;
44 /**
45 * If true, turns on synchronous error rethrowing, which is a deprecated behavior
46 * in v6 and higher. This behavior enables bad patterns like wrapping a subscribe
47 * call in a try/catch block. It also enables producer interference, a nasty bug
48 * where a multicast can be broken for all observers by a downstream consumer with
49 * an unhandled error. DO NOT USE THIS FLAG UNLESS IT'S NEEDED TO BUY TIME
50 * FOR MIGRATION REASONS.
51 *
52 * @deprecated As of version 8, RxJS will no longer support synchronous throwing
53 * of unhandled errors. All errors will be thrown on a separate call stack to prevent bad
54 * behaviors described above. Will be removed in v8.
55 */
56 useDeprecatedSynchronousErrorHandling: boolean;
57 /**
58 * If true, enables an as-of-yet undocumented feature from v5: The ability to access
59 * `unsubscribe()` via `this` context in `next` functions created in observers passed
60 * to `subscribe`.
61 *
62 * This is being removed because the performance was severely problematic, and it could also cause
63 * issues when types other than POJOs are passed to subscribe as subscribers, as they will likely have
64 * their `this` context overwritten.
65 *
66 * @deprecated As of version 8, RxJS will no longer support altering the
67 * context of next functions provided as part of an observer to Subscribe. Instead,
68 * you will have access to a subscription or a signal or token that will allow you to do things like
69 * unsubscribe and test closed status. Will be removed in v8.
70 */
71 useDeprecatedNextContext: boolean;
72}
73//# sourceMappingURL=config.d.ts.map
\No newline at end of file