MCPcopy
hub / github.com/jvilk/BrowserFS / clear

Method clear

src/backend/IndexedDB.ts:161–174  ·  view source on GitHub ↗
(cb: BFSOneArgCallback)

Source from the content-addressed store, hash-verified

159 }
160
161 public clear(cb: BFSOneArgCallback): void {
162 try {
163 const tx = this.db.transaction(this.storeName, 'readwrite'),
164 objectStore = tx.objectStore(this.storeName),
165 r: IDBRequest = objectStore.clear();
166 r.onsuccess = (event) => {
167 // Use setTimeout to commit transaction.
168 setTimeout(cb, 0);
169 };
170 r.onerror = onErrorHandler(cb);
171 } catch (e) {
172 cb(convertError(e));
173 }
174 }
175
176 public beginTransaction(type: 'readonly'): AsyncKeyValueROTransaction;
177 public beginTransaction(type: 'readwrite'): AsyncKeyValueRWTransaction;

Callers

nothing calls this directly

Calls 4

onErrorHandlerFunction · 0.85
cbFunction · 0.85
convertErrorFunction · 0.70
clearMethod · 0.65

Tested by

no test coverage detected