Colibrio Reader Framework API - Cloud license
    Preparing search index...

    Interface IReaderPublicationStorage

    Allows management of a ReaderPublication's storage state, such as 'localStorage' for EPUB. This allows applications to save and restore the IReaderPublicationStorageState across reading-sessions and devices.

    The API acts as a proxy for the Web Storage API, but does not use the same storage mechanism as the browser.

    interface IReaderPublicationStorage {
        getStorageArea(
            type: ReaderPublicationStorageAreaType,
        ): IReaderPublicationStorageArea;
        getStorageSizeLimit(): number;
        setStorageSizeLimit(sizeLimit: number): void;
    }

    Methods

    • Get the size limit of each publication storage area. The size of a publication storage area is defined as the total string length of all the keys and values in the storage area.

      A ReaderDocument script cannot insert a key-value pair into the localStorage or sessionStorage if it causes the total size to become greater than this size limit.

      This size limit is only used when a content document uses the Web Storage APIs in JavaScript. It is ignored if any method in IReaderPublicationStorage or IReaderPublicationStorageArea is used to modify the contents of a storage area.

      Returns number

    • Set the size limit of each publication storage area. The size of a publication storage area is defined as the total string length of all the keys and values in the storage area.

      A ReaderDocument script cannot insert a key-value pair into the localStorage or sessionStorage if it causes the total size to become greater than this size limit.

      This size limit is only used when a content document uses the Web Storage APIs in JavaScript. It is ignored if any method in IReaderPublicationStorage or IReaderPublicationStorageArea is used to modify the contents of a storage area.

      The default size limit is 5000000.

      Parameters

      • sizeLimit: number

      Returns void