A browser-based TypeScript playground for the Tana runtime, inspired by the TypeScript Playground and built with the same architecture as linkhash.
┌─────────────────┐ ┌──────────────────────┐
│ Main Thread │ │ Web Worker │
│ (Monaco Editor)│ ◄─────► │ (TS Compiler + Eval)│
│ │ msgs │ │
└─────────────────┘ └──────────────────────┘
│ │
│ │
User writes Transpile & Execute
TypeScript (pure JavaScript)
The code executes entirely in the browser:
postMessageRun setup (copies TypeScript compiler):
./setup.sh
Install dependencies:
npm install
Start dev server:
npm run dev
tana:coreCore runtime APIs:
console.log() / console.error() - Outputversion - Runtime version infotana:utilsUtility functions:
fetch() - Whitelisted HTTP requests (see FETCH.md)playground/
├── public/
│ └── js/
│ ├── worker.js # Web Worker for code execution
│ └── typescript.js # TypeScript compiler (copied by setup.sh)
├── src/
│ ├── components/
│ │ └── Editor.svelte # Main editor component
│ ├── layouts/
│ │ └── BaseLayout.astro # Base HTML layout
│ └── pages/
│ └── index.astro # Main playground page
└── setup.sh # Setup script
To add new Tana blockchain APIs:
Edit public/js/worker.js and add to the tanaModules object:
const tanaModules = {
'tana:core': {
console: { /* ... */ },
version: { /* ... */ },
blockchain: {
createTransaction(from, to, amount) {
// Your implementation
},
getBalance(address) {
// Mock or simulated balance
return 1000.0;
}
}
}
};
Add type definitions in ../types/tana-core.d.ts
Restart the dev server
Same as parent project.
A browser-based TypeScript playground for the Tana runtime, inspired by the TypeScript Playground and built with the same architecture as linkhash.
┌─────────────────┐ ┌──────────────────────┐
│ Main Thread │ │ Web Worker │
│ (Monaco Editor)│ ◄─────► │ (TS Compiler + Eval)│
│ │ msgs │ │
└─────────────────┘ └──────────────────────┘
│ │
│ │
User writes Transpile & Execute
TypeScript (pure JavaScript)
The code executes entirely in the browser:
postMessageRun setup (copies TypeScript compiler):
./setup.sh
Install dependencies:
npm install
Start dev server:
npm run dev
tana:coreCore runtime APIs:
console.log() / console.error() - Outputversion - Runtime version infotana:utilsUtility functions:
fetch() - Whitelisted HTTP requests (see FETCH.md)playground/
├── public/
│ └── js/
│ ├── worker.js # Web Worker for code execution
│ └── typescript.js # TypeScript compiler (copied by setup.sh)
├── src/
│ ├── components/
│ │ └── Editor.svelte # Main editor component
│ ├── layouts/
│ │ └── BaseLayout.astro # Base HTML layout
│ └── pages/
│ └── index.astro # Main playground page
└── setup.sh # Setup script
To add new Tana blockchain APIs:
Edit public/js/worker.js and add to the tanaModules object:
const tanaModules = {
'tana:core': {
console: { /* ... */ },
version: { /* ... */ },
blockchain: {
createTransaction(from, to, amount) {
// Your implementation
},
getBalance(address) {
// Mock or simulated balance
return 1000.0;
}
}
}
};
Add type definitions in ../types/tana-core.d.ts
Restart the dev server
Same as parent project.