1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// SPDX-License-Identifier: 0BSD
export function jsm(strings: TemplateStringsArray, ...values: any[]) {
const code = String.raw({ raw: strings }, ...values);
return createModuleURL(code, "application/javascript");
}
export function tsm(strings: TemplateStringsArray, ...values: any[]) {
const code = String.raw({ raw: strings }, ...values);
return createModuleURL(code, "application/typescript");
}
export function createModuleURL(code: BlobPart, type: string) {
const blob = new Blob([code], { type });
return URL.createObjectURL(blob);
}
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
March 6, 2024