feat: event emitter

This commit is contained in:
2023-11-07 13:28:01 +00:00
parent fc3d196f48
commit fcd2c8a3a0
8 changed files with 87 additions and 68 deletions

View File

@ -87,13 +87,14 @@ const System = new NostrSystem({
relayMetrics: RelayMetrics,
queryOptimizer: hasWasm ? WasmQueryOptimizer : undefined,
db: SystemDb,
authHandler: async (c, r) => {
const { id } = LoginStore.snapshot();
const pub = LoginStore.getPublisher(id);
if (pub) {
return await pub.nip42Auth(c, r);
}
},
});
System.on("auth", async (c, r, cb) => {
const { id } = LoginStore.snapshot();
const pub = LoginStore.getPublisher(id);
if (pub) {
cb(await pub.nip42Auth(c, r));
}
});
async function fetchProfile(key: string) {