()
| 27 | } |
| 28 | |
| 29 | export 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 | |
| 53 | export async function indexUpdate() { |
| 54 | const types = ['anime', 'manga']; |
no test coverage detected