FeaturesTemplatesShowcaseTownie
AI
BlogDocsPricing
Log inSign up
andreterron
andreterronInjectCodeOnValTownStream
Public
Like
InjectCodeOnValTownStream
Home
Code
2
README.md
S
main.tsx
Branches
1
Pull requests
Remixes
History
Environment variables
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in miliseconds.
Sign up now
Code
/
Code
/
Search
README.md

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

Create val
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()), ); };

Migrated from folder: A_Features/_24_02_15_Open_In_ValTown/InjectCodeOnValTownStream

Code
README.md
S
main.tsx
Go to top
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Product
FeaturesPricing
Developers
DocsStatusAPI ExamplesNPM Package Examples
Explore
ShowcaseTemplatesNewest ValsTrending ValsNewsletter
Company
AboutBlogCareersBrandhi@val.town
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.