-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.ts
37 lines (29 loc) · 1.06 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import type { Address, Language, Interaction, HolochainLanguageDelegate, LanguageContext } from "@perspect3vism/ad4m";
import { JuntoSocialContextLinkAdapter } from "./linksAdapter";
import { JuntoSettingsUI } from "./settingsUI";
import { DNA, DNA_NICK } from "./dna";
function interactions(expression: Address): Interaction[] {
return [];
}
const activeAgentDurationSecs = 300;
export const name = "social-context";
export default async function create(context: LanguageContext): Promise<Language> {
const Holochain = context.Holochain as HolochainLanguageDelegate;
const linksAdapter = new JuntoSocialContextLinkAdapter(context);
const settingsUI = new JuntoSettingsUI();
await Holochain.registerDNAs(
[{ file: DNA, nick: DNA_NICK }],
(signal) => { linksAdapter.handleHolochainSignal(signal) }
);
await linksAdapter.addActiveAgentLink(Holochain);
setInterval(
await linksAdapter.addActiveAgentLink.bind(Holochain),
activeAgentDurationSecs * 1000
);
return {
name,
linksAdapter,
settingsUI,
interactions,
} as Language;
}