Skip to content
@drupflare/spool v1.0.0 GitHub
    Preparing search index...

    Type Alias ActivityHost

    everything the hook needs from the page, injected so node can drive it

    type ActivityHost = {
        clearTimeout(handle: unknown): void;
        hidden(): boolean;
        observe(target: Element, listener: (onScreen: boolean) => void): () => void;
        onVisibilityChange(listener: () => void): () => void;
        setTimeout(callback: () => void, ms: number): unknown;
    }
    Index
    • cancels a timer from setTimeout

      Parameters

      • handle: unknown

      Returns void

    • calls listener with whether the target is on screen; returns the function that stops it

      Parameters

      • target: Element
      • listener: (onScreen: boolean) => void

      Returns () => void

    • calls listener on each visibility change; returns the function that stops it

      Parameters

      • listener: () => void

      Returns () => void

    • runs callback after ms milliseconds; returns a handle for clearTimeout

      Parameters

      • callback: () => void
      • ms: number

      Returns unknown