File size: 664 Bytes
6e41657
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
28
29
30
31
32
33
import { db } from './db';

export interface DebugAsset {
  type: string;
  url: string;
  file: Blob;
  title: string;
  fakeid: string;
}

/**

 * 更新 html 缓存

 * @param html 缓存

 */
export async function updateDebugCache(html: DebugAsset): Promise<boolean> {
  return db.transaction('rw', 'debug', async () => {
    await db.debug.put(html);
    return true;
  });
}

/**

 * 获取 asset 缓存

 * @param url

 */
export async function getDebugCache(url: string): Promise<DebugAsset | undefined> {
  return db.debug.get(url);
}

export async function getDebugInfo(): Promise<DebugAsset[]> {
  return db.debug.toArray();
}