ChemPal Documentation - v1.6.0
    Preparing search index...

    Function isSameBadgeOutput

    • True when two BadgeOutputs would put the badge in the same visible state. Used to skip redundant re-applies within a session — most importantly, so a repeated animate doesn't restart (and visibly reset) the ellipsis cycle.

      Parameters

      • a: null | BadgeOutput

        The previously applied output (or null if none yet).

      • b: BadgeOutput

        The output about to be applied.

      Returns boolean

      Whether they are visually equivalent.

      isSameBadgeOutput({ kind: "text", value: "5" }, { kind: "text", value: "5" }); // true
      isSameBadgeOutput({ kind: "animate" }, { kind: "clear" }); // false
      export function isSameBadgeOutput(a: BadgeOutput | null, b: BadgeOutput): boolean {
      if (a === null || a.kind !== b.kind) return false;
      if (a.kind === 'text' && b.kind === 'text') return a.value === b.value;
      return true;
      }