Comments (2)
Awesome. Let's do it.
from tinybase.
I've put together a super fast hack and confirmed that this works to allow a query on an indexeddb from a service worker, where WINDOW will be undefined:
let db;
if (WINDOW) {
db = WINDOW.indexedDB;
}
else {
db = indexedDB;
}
const request = db.open(dbName, create ? 2 : undefined);
No idea if this is the best way to check, or how this holds up under different circumstances, or how you would even write a decent test for it.
As far as I can tell, you could also get away with writing it like this, without using WINDOW at all, and assuming that indexedDB shows up somewhere in the global scope in both cases:
const request = indexedDB.open(dbName, create ? 2 : undefined);
from tinybase.
Related Issues (20)
- Clarify that etags are required for the remote persister HOT 4
- React UI Hooks don't seem to have "with-schema" variants HOT 1
- VSCode Auto Import not working correctly HOT 5
- Page of community apps and demos
- First party CRDT support
- expo-sqlite-next-persister not working HOT 3
- Create of IndexedDB persister is slow when database doesn't exist HOT 7
- useCreate hooks do not work when React.StrictMode is enabled HOT 4
- PowerSync support HOT 2
- Persists Tinybase to Turso's SQLite Edge HOT 8
- StoreInspector doesn't seem to work on API generated Providers HOT 1
- Develop a Vite plugin for getStoreApi HOT 2
- Add Zod and Effect Schema support for better DX HOT 8
- Consider using Bun for the development of TinyBase itself HOT 1
- Persist TinyBase to Astro DB
- Support TS `moduleResolution: node16` HOT 5
- Loro CRDT Addition
- 'Pagination' for SQLite persistence
- Extra persister events (start + finish) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tinybase.