INNER CODE UNIT · JavaScript

PageUrls

theyosh/TerrariumPI · gui/pages/index.js:348

export const PageUrls = Pages.reduce((acc, x) => {
  acc[x.name] = x.url;
  if (x.subroutes) {
    // Recursive....
    acc = x.subroutes.reduce((bcc, y) => {
      bcc[y.name] = y.url;
      return bcc;
    }, acc);
  }
  return acc;
}, {});

export const onRouteLoaded = async (route) => {
  const page = Pages.find((x) => x.url === route.route);

  if (!page || get(customPageTitleUsed)) return;

  pageTitle.set(typeof page.title === 'function' ? await page.title() : page.title);

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…