Vaultrice SDK - v0.9.18
    Preparing search index...

    Function createOfflineNonLocalStorage

    • Creates an offline-capable NonLocalStorage instance. Synchronizes local changes with remote storage when online, and queues changes for later sync when offline. Provides a unified API for item management, event handling, and connection state.

      Parameters

      • credentials: Credentials

        Credentials for remote storage access.

      • OptionalidOrOptions: string | OfflineSyncOptions

        Either a string ID or an OfflineSyncOptions object.

      Returns Promise<NonLocalStorage>

      A promise that resolves to a NonLocalStorage instance.

      const nls = await createOfflineNonLocalStorage({ projectId: 'myProject' }, { ttl: 60000 });
      await nls.setItem('key', 'value');
      const value = await nls.getItem('key');