JAVASCRIPT · KAPSULA 0.4.0
Got a JavaScript script from AI? Kapsula 0.4.0 runs it without an HTML wrapper, separate build or developer account. Reopen the saved source, refine it and copy an error for your AI assistant.
Your projects need Kapsula Pro: a monthly subscription with a 7-day trial for eligible new subscribers, or a lifetime purchase. Prices are shown in the app. The built-in demo is free.
Save this as counter.js or paste it using JavaScript (.js). Tap +1, close and reopen the same project: its storage restores the count.
await kapsula.ready;
const countKey = 'my-counter-v1';
let count = Number(await kapsula.storage.get(countKey)) || 0;
const app = document.getElementById('app');
app.innerHTML = '<h1>My counter</h1><p id="count"></p>' +
'<button id="add">+1</button><p id="status" role="status"></p>';
const render = () => { document.getElementById('count').textContent = count; };
render();
document.getElementById('add').onclick = async function () {
this.disabled = true;
try {
await kapsula.storage.set(countKey, count + 1);
count += 1;
render();
document.getElementById('status').textContent = 'Saved';
} catch (error) {
document.getElementById('status').textContent = String(error.message || error);
} finally {
this.disabled = false;
}
};Copy this prompt into your AI chat and replace the final line with your task.
TypeScript (.ts) is available in 0.5.0: guide and workout log →
One plain JavaScript script without imports/exports or external dependencies. Top-level await works inside the Kapsula runner. Add CSS with a style element. HTML with CSS/JS remains supported as a separate format. TypeScript, React/JSX, npm projects and Python are not supported in 0.4.0. No camera, files/share, location or network bridge was added.
The script uses the same API: project storage, up to 16 scheduled notifications, foreground sound and haptics. Request notifications through kapsula.notify.schedule; JavaScript does not run continuously in the background. Delivery and sound depend on OS permissions and settings. Test a short notification on your device.
There is no version history or code rollback yet. Save a working source copy before replacing it. Creating a new project does not copy the old project’s data.