Add shared types for web workers
This commit is contained in:
parent
66a27cb03c
commit
6fa04317b6
33
src/workers/worker.types.ts
Normal file
33
src/workers/worker.types.ts
Normal file
@ -0,0 +1,33 @@
|
||||
/**
|
||||
* Shared types for Web Workers
|
||||
*/
|
||||
|
||||
export interface StoreDefinition {
|
||||
name: string;
|
||||
options: IDBObjectStoreParameters;
|
||||
indices: IndexDefinition[];
|
||||
}
|
||||
|
||||
export interface IndexDefinition {
|
||||
name: string;
|
||||
keyPath: string | string[];
|
||||
options: IDBIndexParameters;
|
||||
}
|
||||
|
||||
export interface WorkerMessagePayload {
|
||||
type: string;
|
||||
payload?: any;
|
||||
id: number;
|
||||
}
|
||||
|
||||
export interface WorkerMessageResponse {
|
||||
id: number;
|
||||
type: 'SUCCESS' | 'ERROR';
|
||||
result?: any;
|
||||
error?: string;
|
||||
}
|
||||
|
||||
export interface BatchWriteItem {
|
||||
key?: IDBValidKey;
|
||||
object: any;
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user