( fpsCap: number, nativeConfig: Readonly<Record<string, unknown>>, )
| 218 | } |
| 219 | |
| 220 | export function resolveTargetFps( |
| 221 | fpsCap: number, |
| 222 | nativeConfig: Readonly<Record<string, unknown>>, |
| 223 | ): number { |
| 224 | const values = readNativeTargetFpsValues(nativeConfig); |
| 225 | if (values.camel !== null && values.snake !== null && values.camel !== values.snake) { |
| 226 | throw new ZrUiError( |
| 227 | "ZRUI_INVALID_PROPS", |
| 228 | `createNodeBackend config mismatch: nativeConfig.targetFps=${String(values.camel)} must match nativeConfig.target_fps=${String(values.snake)}.`, |
| 229 | ); |
| 230 | } |
| 231 | const nativeTargetFps = values.camel ?? values.snake; |
| 232 | if (nativeTargetFps !== null && nativeTargetFps !== fpsCap) { |
| 233 | throw new ZrUiError( |
| 234 | "ZRUI_INVALID_PROPS", |
| 235 | `createNodeBackend config mismatch: fpsCap=${String(fpsCap)} must match nativeConfig.targetFps/target_fps=${String(nativeTargetFps)}. Fix: set nativeConfig.targetFps (or target_fps) to ${String(fpsCap)}, or remove the override and use fpsCap only.`, |
| 236 | ); |
| 237 | } |
| 238 | return fpsCap; |
| 239 | } |
no test coverage detected