MCPcopy Index your code
hub / github.com/utterance/utterances / bootstrap

Function bootstrap

src/utterances.ts:31–76  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

29}
30
31async function bootstrap() {
32 await loadToken();
33 // tslint:disable-next-line:prefer-const
34 let [issue, user] = await Promise.all([
35 loadIssue(),
36 loadUser(),
37 loadTheme(page.theme, page.origin)
38 ]);
39
40 startMeasuring(page.origin);
41
42 const timeline = new TimelineComponent(user, issue);
43 document.body.appendChild(timeline.element);
44
45 if (issue && issue.comments > 0) {
46 renderComments(issue, timeline);
47 }
48
49 scheduleMeasure();
50
51 if (issue && issue.locked) {
52 return;
53 }
54
55 enableReactions(!!user);
56
57 const submit = async (markdown: string) => {
58 await assertOrigin();
59 if (!issue) {
60 issue = await createIssue(
61 page.issueTerm as string,
62 page.url,
63 page.title,
64 page.description || '',
65 page.label
66 );
67 timeline.setIssue(issue);
68 }
69 const comment = await postComment(issue.number, markdown);
70 timeline.insertComment(comment, true);
71 newCommentComponent.clear();
72 };
73
74 const newCommentComponent = new NewCommentComponent(user, submit);
75 timeline.element.appendChild(newCommentComponent.element);
76}
77
78bootstrap();
79

Callers 1

utterances.tsFile · 0.85

Calls 8

loadTokenFunction · 0.90
loadUserFunction · 0.90
loadThemeFunction · 0.90
startMeasuringFunction · 0.90
scheduleMeasureFunction · 0.90
enableReactionsFunction · 0.90
loadIssueFunction · 0.85
renderCommentsFunction · 0.85

Tested by

no test coverage detected