()
| 25 | }>(); |
| 26 | |
| 27 | function getScopes(): { scope: Scope; isolationScope: Scope } { |
| 28 | const scopes = asyncStorage.getStore(); |
| 29 | |
| 30 | if (scopes) { |
| 31 | return scopes; |
| 32 | } |
| 33 | |
| 34 | // fallback behavior: |
| 35 | // if, for whatever reason, we can't find scopes on the context here, we have to fix this somehow |
| 36 | return { |
| 37 | scope: getDefaultCurrentScope(), |
| 38 | isolationScope: getDefaultIsolationScope(), |
| 39 | }; |
| 40 | } |
| 41 | |
| 42 | function withScope<T>(callback: (scope: Scope) => T): T { |
| 43 | const scope = getScopes().scope.clone(); |
no test coverage detected