Skip to content

Make use of new indexeddb StorageBucket API #2013

Closed

Description

@nickchomey

The Storage Bucket API (Background blog) in Chromium browsers allows for better control of persistence and eviction. It is now also more performant, with a sort of multi-threaded implementation.

It would be beneficial if Dexie could implement its use in browsers that support it

Activity

  1. dfahlander commented on Jun 18, 2024

    @dfahlander
    Collaborator

    It should already be possible:

    const bucket = await navigator.storageBuckets.open('my-bucket');
    const db = new Dexie('my-db', { indexedDB: bucket.indexedDB });

    However, it could probably also be worth it to support it more user-friendly in Dexie. For example:

    const db = new Dexie('my-db', {
      bucket: 'my-bucket',
      persisted: true // passed to storageBuckets.open()
    });

    Question would be how to behave on browsers without the storagebuckets api? Probably to ignore the bucket and persisted arguments, or maybe default persisted to try StorageManager.persist(). But then what happens when the same user upgrades their browser and it gets this API? Probably user will suddenly get an empty DB now that the bucket is created.

    Comments?

  2. locked and limited conversation to collaborators on Jun 18, 2024
  3. converted this issue into a discussion #2014 on Jun 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions