SheetXL - v1.0.2
    Preparing search index...

    Interface ISnapshot<T, J>

    Represents an immutable reference to an ICellRange, capturing its content and metadata. It may include complex objects such as tables, movables, images, listeners, or other items.

    ISnapshot can be provided to ICellRange.copyFrom.

    interface ISnapshot<T = any, J = any> {
        isISnapshot: true;
        copyTo(
            destination: ICellRange,
            options?: ICellRange.CopyOptions,
        ): Coords | null;
        getCoords?(): Readonly<IRange.Coords>;
        getMarkOptions(): ICellRange.CopyOptions;
        getName?(): string;
        getSource(): T;
        prepare?(
            destination: ICellRange,
            options?: ICellRange.CopyOptions,
        ): void | Promise<void>;
        toHtml?(): string | Promise<string>;
        toImage?(): Blob | Promise<Blob>;
        toJSON?(): J | Promise<J>;
        toText?(): string | Promise<string>;
    }

    Type Parameters

    • T = any
    • J = any
    Index
    isISnapshot: true

    For runtime type checking.

    • Copies the snapshot to the specified range.

      Parameters

      Returns Coords | null

      The coordinates the copy covered, or null when it placed no cells.

      The copy is made inside the paste's transaction, so it completes synchronously; anything that has to wait belongs in prepare.

    • Retrieves the coordinates that bound the current snapshot.

      Returns Readonly<IRange.Coords>

      The IRange.Coords defining the bounds of the snapshot.

    • A user friendly name of a the snapshot item.

      Returns string

    • The source that created the snapshot. This is used by copy to quickly do comparisons.

      Returns T

    • Does the asynchronous work a paste needs, before copyTo is called.

      Parameters

      Returns void | Promise<void>

      ICellRange.copyFrom calls this first, outside any transaction, and then copyTo inside the paste's transaction. Anything that has to wait - loading a kind of content, decoding an image - is done here, so that copyTo can complete synchronously. A snapshot with nothing to wait for leaves this out, or returns void; the paste then runs to its commit in the caller's synchronous extent.

    • Converts the snapshot to an HTML representation.

      Returns string | Promise<string>

      A string or promise resolving to the HTML representation of the snapshot.

    • Converts the snapshot to an image blob.

      Returns Blob | Promise<Blob>

      A Blob or promise resolving to the image representation of the snapshot.

    • Converts the snapshot to a JSON object.

      Returns J | Promise<J>

      A JSON object or promise resolving to the JSON representation of the snapshot.

    • Converts the snapshot to a plain text representation.

      Returns string | Promise<string>

      A string or promise resolving to the text representation of the snapshot.