0
0
Fork 0

Free stroage if it is exceeding disk quota (#7061)

This commit is contained in:
Akihiko Odaki 2018-04-08 20:32:39 +09:00 committed by Eugen Rochko
parent b83ce18b30
commit 1ed1014546
6 changed files with 89 additions and 36 deletions

View file

@ -1,15 +1,14 @@
import { me } from '../initial_state';
export default new Promise((resolve, reject) => {
export default () => new Promise((resolve, reject) => {
// ServiceWorker is required to synchronize the login state.
// Microsoft Edge 17 does not support getAll according to:
// Catalog of standard and vendor APIs across browsers - Microsoft Edge Development
// https://developer.microsoft.com/en-us/microsoft-edge/platform/catalog/?q=specName%3Aindexeddb
if (!me || !('getAll' in IDBObjectStore.prototype)) {
if (!('caches' in self && 'getAll' in IDBObjectStore.prototype)) {
reject();
return;
}
const request = indexedDB.open('mastodon:' + me);
const request = indexedDB.open('mastodon');
request.onerror = reject;
request.onsuccess = ({ target }) => resolve(target.result);