Store settings in lowdb
This commit is contained in:
38
events/StorageEvents.ts
Normal file
38
events/StorageEvents.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import { Event } from './'
|
||||
|
||||
interface StorageEvent {
|
||||
transactionId: string
|
||||
}
|
||||
|
||||
export interface StoreCommand extends StorageEvent {
|
||||
store: string,
|
||||
data: any
|
||||
}
|
||||
|
||||
export interface LoadCommand extends StorageEvent {
|
||||
store: string,
|
||||
}
|
||||
|
||||
export const storageStoreEvent: Event<StoreCommand> = {
|
||||
topic: 'storage/store',
|
||||
}
|
||||
|
||||
export const storageLoadEvent: Event<LoadCommand> = {
|
||||
topic: 'storage/load',
|
||||
}
|
||||
|
||||
export function makeStorageAcknoledgementEvent(transactionId: string): Event<StoreCommand> {
|
||||
return {
|
||||
topic: `storage/ack/${transactionId}`,
|
||||
}
|
||||
}
|
||||
|
||||
export function makeStorageResponseEvent(transactionId: string): Event<StoreCommand> {
|
||||
return {
|
||||
topic: `storage/response/${transactionId}`,
|
||||
}
|
||||
}
|
||||
|
||||
export const storageClearEvent: Event<StorageEvent> = {
|
||||
topic: 'storage/clear',
|
||||
}
|
||||
Reference in New Issue
Block a user