-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🐴 kastro: add native web worker support
- Loading branch information
1 parent
5ae336a
commit 906c5dc
Showing
6 changed files
with
33 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,3 @@ | ||
import { getGlobals } from "@kimlikdao/lib/kastro/compiler/pageGlobals"; | ||
import { Script } from "@kimlikdao/lib/kastro/script"; | ||
|
||
export default (props) => { | ||
const globals = getGlobals(); | ||
for (const key in props) { | ||
if (key.charCodeAt(0) < 91) globals[key] = props[key]; | ||
} | ||
return Script({ ...props, src: "SOURCE" }); | ||
} | ||
export default (props) => Script({ ...props, src: "SOURCE" }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,27 @@ | ||
import { tagYaz } from "../util/html"; | ||
import compiler from "./compiler/compiler"; | ||
import { getGlobals } from "./compiler/pageGlobals"; | ||
|
||
/** | ||
* @param {Object} props | ||
* @return {!Promise<string>} | ||
*/ | ||
const Script = (props) => | ||
compiler.bundleTarget(`/build/${props.src.slice(0, -3)}-${props.Lang}.js`, { | ||
dynamicDeps: true, | ||
childTargets: ["/" + props.src], // Used in BuildMOde.Dev only | ||
...props | ||
}).then((bundledName) => tagYaz("script", { type: "module", src: bundledName }, false) + "</script>"); | ||
const Script = (props) => { | ||
const globals = getGlobals(); | ||
for (const key in props) | ||
if (key.charCodeAt(0) < 91) globals[key] = props[key]; | ||
|
||
return Promise.all([].concat(props.children ?? [])).then(() => | ||
compiler.bundleTarget(`/build/${props.src.slice(0, -3)}-${props.Lang}.js`, { | ||
dynamicDeps: true, | ||
childTargets: ["/" + props.src], // Used in BuildMOde.Dev only | ||
...props, | ||
...globals | ||
}).then((bundleName) => { | ||
if (props.bundleKey) globals[props.bundleKey] = bundleName; | ||
return tagYaz("script", { type: "module", src: bundleName }, false) + "</script>" | ||
}) | ||
); | ||
} | ||
|
||
export { Script }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters