I can not seem to figure out HOW to use indexedDB
inside web worker. I've tried a lot of different ways, but indexedDB
is always "undefined"
in worker scope. I thought it was supposed to be accessible via indexedDB
or self.indexedDB
???
self.indexedDB = self.indexedDB || self.msIndexedDB || self.mozIndexedDB || self.webkitIndexedDB || self.OIndexedDB;
indexedDB = indexedDB || msIndexedDB || mozIndexedDB || webkitIndexedDB || OIndexedDB;
all are undefined
... i even iterated through the properties of the self object, and there was no indexedDB
property or method. fwiw, i'm using ff 18, AND, ff nightly (21a), and i tried it with chrome.
Update September 2015: Accessing IndexedDB from web worker in Firefox is now possible: https://bugzilla.mozilla.org/show_bug.cgi?id=701634
If you want to use IndexedDB in chrome just use the following line:
indexedDB = typeof window == 'object' ? window.indexedDB : webkitIndexedDB;
indexeddb is accessible from Web Workers since firefox 37
(released March 31st, 2015).
IndexedDB
Database to store records holding simple values and hierarchical objects.
See Functions and classes available to Web Workers (MDN)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With