1 | /**
|
2 | * Array of callbacks to invoke when a new context is created
|
3 | */
|
4 | const notifyNewContext = [];
|
5 | /**
|
6 | * Used internally to setup a new Context
|
7 | */
|
8 | export function onContextInit(cb) {
|
9 | notifyNewContext.push(cb);
|
10 | }
|
11 | /**
|
12 | * Invoke any classes which need to also be initialized when a new context is created.
|
13 | */
|
14 | export function initializeContext(ctx) {
|
15 | // add any additional modules
|
16 | notifyNewContext.forEach((cb) => cb(ctx));
|
17 | }
|
18 | /**
|
19 | * Array of callbacks to invoke when a new context is closed
|
20 | */
|
21 | const notifyCloseContext = [];
|
22 | /**
|
23 | * Used internally to tear down a Context
|
24 | */
|
25 | export function onContextClose(cb) {
|
26 | notifyCloseContext.push(cb);
|
27 | }
|
28 | export function closeContext(ctx) {
|
29 | // remove any additional modules
|
30 | notifyCloseContext.forEach((cb) => cb(ctx));
|
31 | }
|
32 | //# sourceMappingURL=ContextInitialization.js.map |
\ | No newline at end of file |