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