MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / safeVoid

Function safeVoid

packages/core/src/runtime/player.ts:23–32  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

21 * (missing or overwritten with a non-callable value), silently skip.
22 */
23function 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
34type PlayerDeps = {
35 getTimeline: () => RuntimeTimelineLike | null;

Calls 1

swallowFunction · 0.90

Tested by

no test coverage detected