Variable: URLPattern
API / @xmachines/play-url / index / URLPattern
const URLPattern: URLPatternCtor;Defined in: packages/play-url/src/url-pattern-utils.ts:75
The URLPattern constructor that this library uses: the native API when the runtime carries one, and the polyfill when it does not.
The native API comes first for two reasons. It is faster, because the engine compiles the pattern itself. And it is the API that the REST of the page already uses, so a pattern that the application builds and a pattern that this library builds behave the same way.
The read of globalThis happens ONE time, when the module loads. A test that replaces
globalThis.URLPattern afterwards therefore changes nothing here, which is what makes
the compiled-pattern cache below safe to keep for the life of the process.