tinyplex / tinybase

The reactive data store for local‑first apps.
https://tinybase.org
MIT License
3.23k stars 65 forks source link

Closes #116 IndexedDB integration for service workers #128

Closed devjume closed 5 months ago

devjume commented 5 months ago

Summary

How did you test this change?

Ran all the tests successfully and confirmed that the fix indeed works with my own Chrome extension.

Side note:

Didn't add any new tests. After reviewing the codebase, I believe it may not be necessary to add them, but I'm not entirely sure of this. Further review or feedback might be helpful.

jamesgpearce commented 5 months ago

WOW! Sorry I haven't looked at this yet - I've been on a boat offshore for the last few days! I'll review this tomorrow and let's get this going. ❤️❤️❤️

jamesgpearce commented 5 months ago

In fact you could even dedupe the method name & params:

const request = (WINDOW ? WINDOW.indexedDB : indexedDB).open(dbName, create ? 2 : undefined);
devjume commented 5 months ago

I refactored the code and ran the tests.

jamesgpearce commented 5 months ago

Awesome! Let's go for it. I wonder if we should eventually use globalThis but this will work for now. Thank you again!