From 4ed3736a6123133c745bc85e6ba77720fc48f3fc Mon Sep 17 00:00:00 2001 From: Omar Rizwan Date: Thu, 22 Apr 2021 17:23:05 -0700 Subject: [PATCH] extension: add runtime/routes.html --- extension/background.js | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/extension/background.js b/extension/background.js index c885d45..d2e2ac8 100644 --- a/extension/background.js +++ b/extension/background.js @@ -613,9 +613,33 @@ Routes["/runtime/background.js"] = { } }; +Routes["/runtime/routes.html"] = routeWithContents(async () => { + return ` + + +
+ ${Object.entries(Routes).map(([path, {usage}]) => { + const usages = usage ? (Array.isArray(usage) ? usage : [usage]) : []; + return ` +
${path}
+
Usage: +
    + ${usages.map(u => `
  • ${u}
  • `).join('\n')} +
+
+ `; + }).join('\n')} +
+ + +`; +}); + Routes["/runtime/background.js.html"] = routeWithContents(async () => { + // WIP const classes = [ - [/Routes\["[^\]]+"\] = /, 'route'] + [/Routes\["[^\]]+"\] = /, 'route'], + [/usage:/, 'usage'] ]; const js = await window.backgroundJS; @@ -645,12 +669,6 @@ Routes["/runtime/background.js.html"] = routeWithContents(async () => { -
${classedJs}