| 1 | import { |
| 2 | findRegexCodeMatches, |
| 3 | type RegexSearchRequest, |
| 4 | type RegexSearchResponse, |
| 5 | } from "./codeSearch"; |
| 6 | |
| 7 | const workerScope = globalThis as unknown as { |
| 8 | onmessage: ((event: MessageEvent<RegexSearchRequest>) => void) | null; |
| 9 | postMessage: (response: RegexSearchResponse) => void; |
| 10 | }; |
| 11 | |
| 12 | workerScope.onmessage = (event) => { |
| 13 | workerScope.postMessage(findRegexCodeMatches(event.data)); |
| 14 | }; |
| 15 |