Skip to content

Commit

Permalink
Address PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
twschiller committed Feb 21, 2024
1 parent d7cc217 commit eedeb0c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
22 changes: 13 additions & 9 deletions src/contentScript/contentScriptPlatform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,16 +130,20 @@ class ContentScriptPlatform extends PlatformBase {
context: JsonObject;
autoescape: boolean;
}): Promise<string> {
if (engine === "nunjucks") {
return renderNunjucksTemplate(payload);
switch (engine) {
case "nunjucks": {
return renderNunjucksTemplate(payload);
}

case "handlebars": {
return renderHandlebarsTemplate(payload);
}

default: {
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions -- dynamic check for never
throw new BusinessError(`Unsupported template engine: ${engine}`);
}
}

if (engine === "handlebars") {
return renderHandlebarsTemplate(payload);
}

// eslint-disable-next-line @typescript-eslint/restrict-template-expressions -- dynamic check for never
throw new BusinessError(`Unsupported template engine: ${engine}`);
},

async validate({
Expand Down
4 changes: 2 additions & 2 deletions src/platform/capabilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ export const platformCapabilities = [
"contentScript",
// Show a blocking alert/prompt to the user
"alert",
// Show a form to a user
// Show a form to a user. Currently, covers both modal form (blocking) and panel form (non-blocking)
"form",
// Show a panel to a user
// Show a panel to a user. Currently, covers both modal panel (blocking) and inline/sidebar panel (non-blocking)
"panel",
// Show a non-blocking notification/toast
"toast",
Expand Down

0 comments on commit eedeb0c

Please sign in to comment.