forked from jakearchibald/idb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.ts
27 lines (23 loc) · 875 Bytes
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Since this library proxies IDB, I haven't retested all of IDB. I've tried to cover parts of the
// library that behave differently to IDB, or may cause accidental differences.
import 'mocha/mocha';
import { deleteDatabase } from './utils';
mocha.setup('tdd');
function loadScript(url: string): Promise<void> {
return new Promise((resolve, reject) => {
const script = document.createElement('script');
script.type = 'module';
script.src = url;
script.onload = () => resolve();
script.onerror = () => reject(Error('Script load error'));
document.body.appendChild(script);
});
}
(async function () {
const edgeCompat = navigator.userAgent.includes('Edge/');
if (!edgeCompat) await loadScript('./open.js');
await loadScript('./main.js');
if (!edgeCompat) await loadScript('./iterate.js');
await deleteDatabase();
mocha.run();
})();