MCPcopy Create free account
hub / github.com/ColmapView/Colmapview.github.io / installObjectUrls

Function installObjectUrls

src/hooks/useFrustumTexture.test.ts:269–287  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

267}
268
269function installObjectUrls(): () => void {
270 const originalCreateObjectUrl = Object.getOwnPropertyDescriptor(URL, 'createObjectURL');
271 const originalRevokeObjectUrl = Object.getOwnPropertyDescriptor(URL, 'revokeObjectURL');
272 let nextId = 0;
273
274 Object.defineProperty(URL, 'createObjectURL', {
275 configurable: true,
276 value: vi.fn(() => `blob:frustum-${nextId++}`),
277 });
278 Object.defineProperty(URL, 'revokeObjectURL', {
279 configurable: true,
280 value: vi.fn(),
281 });
282
283 return () => {
284 restoreProperty(URL, 'createObjectURL', originalCreateObjectUrl);
285 restoreProperty(URL, 'revokeObjectURL', originalRevokeObjectUrl);
286 };
287}
288
289function restoreProperty(
290 target: object,

Callers 1

Calls 1

restorePropertyFunction · 0.85

Tested by

no test coverage detected