MCPcopy Index your code
hub / github.com/MALSync/MALSync / initDatabase

Function initDatabase

src/background/database.ts:29–51  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

27}
28
29export async function initDatabase() {
30 logger.log('Starting');
31 db.version(1).stores({
32 anime: '&uid, malId, cacheKey, title',
33 manga: '&uid, malId, cacheKey, title',
34 storage: '&key, value',
35 });
36
37 emitter.on('update.*', async data => updateEntry(data), { objectify: true });
38 emitter.on('state.*', async data => updateEntry(data), { objectify: true });
39
40 emitter.on(
41 'delete.*',
42 async data => {
43 con.log('delete', data);
44 removeEntry(data.type, data.id);
45 },
46 { objectify: true },
47 );
48
49 await indexUpdate();
50 logger.log('Ready');
51}
52
53export async function indexUpdate() {
54 const types = ['anime', 'manga'];

Callers 2

injectDbFunction · 0.90
serviceworker.tsFile · 0.90

Calls 5

updateEntryFunction · 0.85
removeEntryFunction · 0.85
indexUpdateFunction · 0.85
versionMethod · 0.80
onMethod · 0.80

Tested by

no test coverage detected