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

Function handleSetHold

packages/sdk/src/engine/mutate.ts:564–591  ·  view source on GitHub ↗
(
  parsed: ParsedDocument,
  ids: HfId[],
  hold: { start: number; end: number; fill: "freeze" | "loop" },
)

Source from the content-addressed store, hash-verified

562}
563
564function handleSetHold(
565 parsed: ParsedDocument,
566 ids: HfId[],
567 hold: { start: number; end: number; fill: "freeze" | "loop" },
568): MutationResult {
569 const result: MutationResult = { forward: [], inverse: [] };
570 for (const id of ids) {
571 const el = resolveScoped(parsed.document, id);
572 if (!el) continue;
573
574 const fields: Array<["start" | "end" | "fill", string]> = [
575 ["start", String(hold.start)],
576 ["end", String(hold.end)],
577 ["fill", hold.fill],
578 ];
579
580 for (const [field, newVal] of fields) {
581 const attrName = `data-hold-${field}`;
582 const oldVal = el.getAttribute(attrName);
583 const path = holdPath(id, field);
584 el.setAttribute(attrName, newVal);
585 const p = scalarChange(path, oldVal, newVal);
586 result.forward.push(p.forward);
587 result.inverse.push(p.inverse);
588 }
589 }
590 return result;
591}
592
593function handleRemoveElement(parsed: ParsedDocument, ids: HfId[]): MutationResult {
594 const result: MutationResult = { forward: [], inverse: [] };

Callers 1

applyOpFunction · 0.85

Calls 5

resolveScopedFunction · 0.85
holdPathFunction · 0.85
scalarChangeFunction · 0.85
getAttributeMethod · 0.65
setAttributeMethod · 0.65

Tested by

no test coverage detected