2023-09-10 17:56:37 +00:00
|
|
|
import { EventsAdapter, Indices } from "../database.ts";
|
2023-09-07 13:11:59 +00:00
|
|
|
import { EventBus } from "../event-bus.ts";
|
2023-09-10 17:56:37 +00:00
|
|
|
import { NostrEvent } from "../lib/nostr-ts/nostr.ts";
|
|
|
|
import { UI_Interaction_Event } from "./app_update.tsx";
|
2023-09-07 13:11:59 +00:00
|
|
|
|
2023-09-10 17:56:37 +00:00
|
|
|
export const testEventBus = new EventBus<UI_Interaction_Event>();
|
|
|
|
export const data = new Map();
|
|
|
|
export const testEventsAdapter: EventsAdapter = {
|
2023-09-12 14:51:27 +00:00
|
|
|
async remove() {},
|
2023-09-10 17:56:37 +00:00
|
|
|
filter: async (f) => {
|
|
|
|
const events = [];
|
|
|
|
for (const [k, v] of data) {
|
2023-09-18 23:23:03 +00:00
|
|
|
events.push(v);
|
2023-09-10 17:56:37 +00:00
|
|
|
}
|
|
|
|
return events;
|
|
|
|
},
|
|
|
|
get: async (keys: Indices) => {
|
|
|
|
return data.get(keys.id);
|
|
|
|
},
|
|
|
|
put: async (e: NostrEvent) => {
|
|
|
|
data.set(e.id, e);
|
|
|
|
},
|
|
|
|
};
|