importValInChromeConsole
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Say you're developing a chrome extension or some other little script and you're iterating in the chrome console. Over time you may write larger pieces of code that you want to save as a group. Or maybe you want to use TypeScript, which isn't supported in browsers natively. Val Town can provide a decent workflow here.
- Save your code in a Script val
- Ensure the val is Public or Unlisted
- In the chrome console, import your val's module url. For example, for this val it would look like this:
let {test} = await import(`https://esm.town/v/stevekrouse/importValInChromeConsole?${Math.random()}`)
I added a random number to the end of the string to prevent your browser from caching the import. So now you can save in Val Town and then re-run your import line in the Chrome console and the script will re-run in the Chrome console.
Migrated from folder: Archive/importValInChromeConsole