summaryrefslogtreecommitdiff
path: root/src/frontend/render/preact.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/frontend/render/preact.ts')
-rw-r--r--src/frontend/render/preact.ts28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/frontend/render/preact.ts b/src/frontend/render/preact.ts
index eb588209c..3b9e1e6d8 100644
--- a/src/frontend/render/preact.ts
+++ b/src/frontend/render/preact.ts
@@ -3,25 +3,25 @@ import { h } from 'preact';
import type { Component } from 'preact';
export function __preact_static(PreactComponent: Component) {
- return (attrs: Record<string, any>, ...children: any): string => {
- let html = render(
- h(
- PreactComponent as any, // Preact's types seem wrong...
- attrs,
- children
- )
- );
- return html;
- };
+ return (attrs: Record<string, any>, ...children: any): string => {
+ let html = render(
+ h(
+ PreactComponent as any, // Preact's types seem wrong...
+ attrs,
+ children
+ )
+ );
+ return html;
+ };
}
export function __preact_dynamic(PreactComponent: Component, importUrl: string, preactUrl: string) {
- const placeholderId = `placeholder_${String(Math.random())}`;
- return (attrs: Record<string, string>, ...children: any) => {
- return `<div id="${placeholderId}"></div><script type="module">
+ const placeholderId = `placeholder_${String(Math.random())}`;
+ return (attrs: Record<string, string>, ...children: any) => {
+ return `<div id="${placeholderId}"></div><script type="module">
import {h, render} from '${preactUrl}';
import Component from '${importUrl}';
render(h(Component, ${JSON.stringify(attrs)}), document.getElementById('${placeholderId}'));
</script>`;
- };
+ };
}