Skip to content

armgit / orca

Public Imported from GitHub
0

Orca is the place for working with a fleet of agents (e.g. Grok Bot, Claude Code). Run any coding agent with your own subscription. Available on desktop, mobile and remote runtime.

690 B
Raw Blame
// Browsers mark cancel()’s rejected finished promise handled; patch happy-dom’s unhandled rejection or cancelled animations fail tests.

const patchedPrototypes = new WeakSet<Animation>()

export function installHappyDomAnimationCancel(): boolean {
  if (globalThis.Animation === undefined) {
    return false
  }
  const prototype = globalThis.Animation.prototype
  if (patchedPrototypes.has(prototype)) {
    return true
  }
  const cancel = prototype.cancel
  prototype.cancel = function cancelWithHandledFinish(this: Animation): void {
    this.finished.catch(() => {})
    cancel.call(this)
  }
  patchedPrototypes.add(prototype)
  return true
}

installHappyDomAnimationCancel()