Detached Inline Scripts
Workspace Scripts
Hub Scripts
{#if tab == 'inlinescripts'} pickInlineScript(e.detail)} inlineScripts={$app.unusedInlineScripts ? $app.unusedInlineScripts.map((uis) => uis.name) : []} /> {:else if tab == 'workspacescripts'} pickScript(e.detail)} /> {:else if tab == 'hubscripts'} pickHubScript(e.detail.path)} /> {/if}
Choose a language
{#if showScriptPicker} {/if}
Backend
{#each langs as lang} { createInlineScriptByLanguage(lang, name) }} /> {/each}
Frontend Frontend scripts are executed in the browser and can manipulate the app context directly.
{ const newInlineScript = { content: `// read outputs and ctx console.log(ctx.email) // access a global state store if (!state.foo) { state.foo = 0 } state.foo += 1 // for reactivity to work, you need to assign a value and not modify it in place // e.g: state.foo.push(1) will not work but 'state.foo = [...state.foo, 1]' will. // you may also just reassign as next statement 'state.foo = state.foo' // you can also navigate (goto), recompute a script (recompute), or set a tab (setTab) // Inputs and display components support settings their value directly (setValue) // Tables support setting their selected index (setSelectedIndex) return state.foo`, language: 'frontend', path: 'frontend script', schema: undefined } dispatch('new', newInlineScript) }} />