clean up and refactor open graph

This commit is contained in:
Ren Amamiya
2023-08-14 09:03:58 +07:00
parent 33fd7512e7
commit c42c78fc98
12 changed files with 256 additions and 654 deletions

View File

@@ -31,12 +31,26 @@ export default class TauriAdapter implements NDKCacheAdapter {
const event = await this.store.get(result as string);
if (event) {
console.log('cache hit: ', result);
const ndkEvent = new NDKEvent(subscription.ndk, JSON.parse(event as string));
subscription.eventReceived(ndkEvent, undefined, true);
}
}
}
}
if (filter.ids) {
for (const id of filter.ids) {
const key = id;
const event = await this.store.get(key);
if (event) {
console.log('cache hit: ', id);
const ndkEvent = new NDKEvent(subscription.ndk, JSON.parse(event as string));
subscription.eventReceived(ndkEvent, undefined, true);
}
}
}
}
public async setEvent(event: NDKEvent): Promise<void> {