Add task queue, work on socket

This commit is contained in:
Jon Staab
2025-03-20 14:22:40 -07:00
parent 7706034b99
commit 7d0d303dae
10 changed files with 345 additions and 35 deletions
+5 -3
View File
@@ -46,17 +46,19 @@ export type TrustedEvent = HashedEvent & {
[verifiedSymbol]?: boolean
}
export type CreateEventOpts = {
export type MakeEventOpts = {
content?: string
tags?: string[][]
created_at?: number
}
export const createEvent = (
export const makeEvent = (
kind: number,
{content = "", tags = [], created_at = now()}: CreateEventOpts = {},
{content = "", tags = [], created_at = now()}: MakeEventOpts = {},
) => ({kind, content, tags, created_at})
export const createEvent = makeEvent
export const isEventTemplate = (e: EventTemplate): e is EventTemplate =>
Boolean(typeof e.kind === "number" && Array.isArray(e.tags) && typeof e.content === "string")