andreterron avatar
andreterron
rootValRef
Script
An interactive, runnable TypeScript val by andreterron
2
andreterron avatar
andreterron
InjectCodeOnValTownStream
Script
Injects the "Code on Val Town" ribbon on an HTML string stream Usage new InjectCodeOnValTownStream({ handle: "andre", name: "foo" }) - define which val to link to; new InjectCodeOnValTownStream() - infer the val from the call stack. Example: @andreterron/openable_stream import { InjectCodeOnValTownStream } from "https://esm.town/v/andreterron/InjectCodeOnValTownStream"; import { blob } from "https://esm.town/v/std/blob?v=11"; import { html } from "https://esm.town/v/stevekrouse/html?v=5"; export default async (req: Request): Promise<Response> => { await blob.set( "openable_test", `<h2>Hello world!</h2> <style>* { font-family: sans-serif }</style>`, ); const value = await blob.get("openable_test"); return html( value.body .pipeThrough(new TextDecoderStream()) .pipeThrough(new InjectCodeOnValTownStream()) .pipeThrough(new TextEncoderStream()), ); };
0
andreterron avatar
andreterron
InjectHTMLElementStream
Script
Inject HTML Element Stream Use InjectHTMLElementStream to inject an HTML element inside the <body /> or <html /> tag of a streamed HTML string.
1
stevekrouse avatar
stevekrouse
parentReference
Script
Forked from easrng/thisReference
1
andreterron avatar
andreterron
inferRequestVal
Script
An interactive, runnable TypeScript val by andreterron
0
andreterron avatar
andreterron
ValRef
Script
An interactive, runnable TypeScript val by andreterron
0
andreterron avatar
andreterron
codeOnVT_modifyResponse
Script
"Code on Val Town" Response modifier Appends the "Code on Val Town" ribbon to an HTTP Response. Usage new modifyResponse(res, { handle: "andre", name: "foo" }) - define which val to link to; new modifyResponse(res) - infer the val from the call stack. Example: @andreterron/openable_res import { modifyResponse } from "https://esm.town/v/andreterron/codeOnVT_modifyResponse"; import { html } from "https://esm.town/v/stevekrouse/html?v=5"; export default async (req: Request): Promise<Response> => { return modifyResponse(html(` <h2>Hello world!</h2> <style>* { font-family: sans-serif }</style> `)); };
0
andreterron avatar
andreterron
codeOnVT_ribbonElement
Script
"Code on Val Town" Ribbon HTML Element Ribbon element used by @andreterron/codeOnValTown Usage ribbonElement({val: { handle: "andre", name: "foo" }}) - define which val to link to; ribbonElement() - infer the val from the call stack. Example: @andreterron/openable_element import { ribbonElement } from "https://esm.town/v/andreterron/codeOnVT_ribbonElement?v=3"; import { html } from "https://esm.town/v/stevekrouse/html?v=5"; export default async (req: Request): Promise<Response> => { return html(` <h2>Hello world!</h2> <style>* { font-family: sans-serif }</style> ${ribbonElement()} `); };
1
stevekrouse avatar
stevekrouse
refs
Script
An interactive, runnable TypeScript val by stevekrouse
2
1
Next
Updated: July 25, 2024