Skip to content

Commit ca0b7f8

Browse files
committed
fix(plugins): add performance and animation APIs to sandbox for Svelte transitions
1 parent 0129fc4 commit ca0b7f8

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

src/ts/plugins/plugins.svelte.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -575,6 +575,7 @@ export const getV2PluginAPIs = () => {
575575
'TextDecoder',
576576
'URL',
577577
'URLSearchParams',
578+
'performance',
578579
]
579580
for (const key of keys) {
580581
if(allowedKeys.includes(key)){
@@ -608,6 +609,14 @@ export const getV2PluginAPIs = () => {
608609
//@ts-expect-error spreading any[] into clearTimeout - first arg should be number | undefined
609610
return globalThis.clearTimeout(...args);
610611
}
612+
safeGlobal.requestAnimationFrame = (...args: any[]) => {
613+
//@ts-expect-error spreading any[] into requestAnimationFrame - first arg should be FrameRequestCallback
614+
return globalThis.requestAnimationFrame(...args);
615+
}
616+
safeGlobal.cancelAnimationFrame = (...args: any[]) => {
617+
//@ts-expect-error spreading any[] into cancelAnimationFrame - first arg should be number
618+
return globalThis.cancelAnimationFrame(...args);
619+
}
611620
safeGlobal.alert = globalThis.alert;
612621
safeGlobal.confirm = globalThis.confirm;
613622
safeGlobal.prompt = globalThis.prompt;

0 commit comments

Comments
 (0)