MCPcopy Index your code
hub / github.com/tinyplex/tinybase / go

Function go

site/js/common/common.ts:65–90  ·  view source on GitHub ↗
(href: string, updateUrl = true)

Source from the content-addressed store, hash-verified

63) => (element.classList.toggle(toggle) ? added() : 0);
64
65export const go = (href: string, updateUrl = true): void => {
66 const nav = getNav();
67 ['?', '#'].forEach((separator) => {
68 if (href.includes(separator)) {
69 href = href.substring(0, href.indexOf(separator));
70 }
71 });
72 fetch(`${href}nav.json`)
73 .then((response) => response.json())
74 .then((navJson) => {
75 delClass(queryElement(nav, 'li.current'), 'current');
76 updateNav(navJson, queryElement(nav, 'ul'));
77 });
78 fetch(`${href}article.html`)
79 .then((response) => response.text())
80 .then((html) => {
81 const article = getArticle();
82 article.innerHTML = html;
83 article.scrollTo(0, 0);
84 addStackblitz();
85 });
86
87 if (updateUrl) {
88 history.pushState(null, '', href);
89 }
90};
91
92type ExecutableProject = {
93 title: string;

Callers 2

app.tsFile · 0.90
populateResultsFunction · 0.90

Calls 6

delClassFunction · 0.85
queryElementFunction · 0.85
updateNavFunction · 0.85
getArticleFunction · 0.85
addStackblitzFunction · 0.85
getNavFunction · 0.70

Tested by

no test coverage detected