2023-06-30 14:05:57 +00:00
|
|
|
/** @jsx h */
|
2023-09-06 16:29:27 +00:00
|
|
|
import { h, render } from "https://esm.sh/preact@10.17.1";
|
2023-07-13 13:52:52 +00:00
|
|
|
import { Search } from "./search.tsx";
|
2023-09-10 17:56:37 +00:00
|
|
|
import { testEventBus, testEventsAdapter } from "./_setup.test.ts";
|
2023-11-16 13:22:18 +00:00
|
|
|
import { Datebase_View } from "../database.ts";
|
2023-09-10 17:56:37 +00:00
|
|
|
import { InMemoryAccountContext, NostrKind } from "../lib/nostr-ts/nostr.ts";
|
|
|
|
import { PrivateKey } from "../lib/nostr-ts/key.ts";
|
|
|
|
import { prepareNormalNostrEvent } from "../lib/nostr-ts/event.ts";
|
2023-06-30 14:05:57 +00:00
|
|
|
|
2023-09-10 17:56:37 +00:00
|
|
|
const ctx = InMemoryAccountContext.New(PrivateKey.Generate());
|
|
|
|
await testEventsAdapter.put(await prepareNormalNostrEvent(ctx, NostrKind.META_DATA, [], `{"name":"mike"}`));
|
|
|
|
|
2023-11-16 13:22:18 +00:00
|
|
|
const db = await Datebase_View.New(testEventsAdapter, ctx);
|
2023-06-30 14:05:57 +00:00
|
|
|
|
|
|
|
render(
|
|
|
|
<Search
|
2023-09-10 17:56:37 +00:00
|
|
|
placeholder="search for data"
|
|
|
|
emit={testEventBus.emit}
|
|
|
|
db={db}
|
2023-06-30 14:05:57 +00:00
|
|
|
/>,
|
|
|
|
document.body,
|
|
|
|
);
|
|
|
|
|
2023-09-10 17:56:37 +00:00
|
|
|
for await (const e of testEventBus.onChange()) {
|
|
|
|
console.log(e);
|
2023-06-30 14:05:57 +00:00
|
|
|
}
|