* Safely invoke a void method on a timeline. If the method is not a function * (missing or overwritten with a non-callable value), silently skip.
(obj: unknown, method: string)
| 21 | * (missing or overwritten with a non-callable value), silently skip. |
| 22 | */ |
| 23 | function safeVoid(obj: unknown, method: string): void { |
| 24 | const fn = (obj as Record<string, unknown>)?.[method]; |
| 25 | if (typeof fn === "function") { |
| 26 | fn.call(obj); |
| 27 | return; |
| 28 | } |
| 29 | if (fn !== undefined) { |
| 30 | swallow("runtime.player.nonConformantVoid", { method, actual: typeof fn }); |
| 31 | } |
| 32 | } |
| 33 | |
| 34 | type PlayerDeps = { |
| 35 | getTimeline: () => RuntimeTimelineLike | null; |
no test coverage detected