Val Names

Vals are named like a variable export let myName = .... If you don’t supply a name, one will be assigned.

https://www.val.town/v/stevekrouse/example1?v=3

You can only have a single-top level value export in a Val, and as many type exports as you’d like.

Publishing a Val

There are three states for a Val:

  1. 🌎 Public (anyone can view or run)
  2. 🔗 Unlisted (anyone with the name or link can view or run)
  3. 🔒 Private (only you can view or run)

All Vals default to private. You can publish a Val by clicking the 🔒 next to its name.

Publishing your Val as either Public or Unlisted makes it accessible via the Run API. Be careful about publishing a function val that has access to your secrets — your secrets will be used if others call that function via the Run API. Publishing a val makes it a public API.

Referencing a Val

A val can reference other vals, much like a tweet can reference other tweets. For example, this val references the the prior example:

https://www.val.town/embed/stevekrouse.example2

Once you type @ you will get helpful autocomplete on handles and then val names.