Skip to content

Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.

860 B
Raw Blame
import type { AdjustmentOwnerStatus, AdjustmentStatusEngine } from './AdjustmentStatusIcon';

export const createFakeAdjustmentStatus = (): AdjustmentStatusEngine & {
  set(ownerId: string, status: AdjustmentOwnerStatus): void;
} => {
  const statuses = new Map<string, AdjustmentOwnerStatus>();
  const listeners = new Map<string, Set<() => void>>();
  return {
    interaction: {
      getLayerAdjustmentStatus: (ownerId) => statuses.get(ownerId) ?? 'idle',
      subscribeLayerAdjustmentStatus: (ownerId, listener) => {
        const keyed = listeners.get(ownerId) ?? new Set();
        listeners.set(ownerId, keyed);
        keyed.add(listener);
        return () => keyed.delete(listener);
      },
    },
    set: (ownerId, status) => {
      statuses.set(ownerId, status);
      listeners.get(ownerId)?.forEach((listener) => listener());
    },
  };
};