diff --git a/docs/development/extensions/assorted-apis.md b/docs/development/extensions/assorted-apis.md index 3f84d8a6..ddd4048b 100644 --- a/docs/development/extensions/assorted-apis.md +++ b/docs/development/extensions/assorted-apis.md @@ -6,7 +6,7 @@ hide_table_of_contents: true import {ExtensionCode} from './utils.js'; -Now that you are familiar with writing custom extensions, we will share some more APIs. These APIs are available in **both** sandboxed and unsandboxed extensions. They can all be used together. +Now that you are familiar with writing custom extensions, we will share some more APIs. They can all be used together. ## color1, color2, color3 diff --git a/docs/development/extensions/async.md b/docs/development/extensions/async.md index bd2aa8c1..2e0fd7d9 100644 --- a/docs/development/extensions/async.md +++ b/docs/development/extensions/async.md @@ -28,4 +28,4 @@ This also demonstrates error handling. Whenever your promises can reject, fail, ## Next steps -You may have realized that even your blocks that don't return a Promise don't actually run instantly and your extension can't access many APIs. To determine why, we need to [discuss what the "sandbox" really is, and what it means for your extensions](./sandbox.md). +If you've read older guides about custom extensions, you may have seen them talk about a "sandbox". Next, we will [discuss what the sandbox was, and why it no longer matters for your extensions](./sandbox.md). diff --git a/docs/development/extensions/hats.md b/docs/development/extensions/hats.md index 413d2d90..59144077 100644 --- a/docs/development/extensions/hats.md +++ b/docs/development/extensions/hats.md @@ -12,10 +12,6 @@ Event blocks and hat blocks are two types of blocks that allow you to control wh Event blocks are for running scripts in response to an external event. An example of this is "when flag clicked" - the event is when the user clicks on the flag button. "when this sprite clicked" similarly is run in response to a click event, though Scratch does a bit more work to figure out which sprite the event happened on. Event blocks can be used for any external event that lets you run a callback. -:::warning -Event blocks are only supported in unsandboxed extensions. -::: - Event blocks never get executed; they just mark which scripts to run. For example, consider this block you're familiar with: ![when space key pressed](./assets/when-space-key-pressed.svg) @@ -91,10 +87,6 @@ Finally, startHats returns an array of the Thread objects that it started. You c ## Predicate-based hat blocks -:::info -Predicate-based hats are only supported in unsandboxed extensions. -::: - Predicate-based hat blocks let you create something similar to: ![](./assets/forever-if-something-then.svg) @@ -125,10 +117,6 @@ This is a subtle but important difference. Consider these two scripts: While the blocks may look similar, they have a significant difference. The top one will only run *once* when the timer *becomes* 5 while the bottom one will run repeatedly after the timer reaches 5. -:::info -Edge-activated hats can be used in any extension, even sandboxed ones -::: - Let's think about how you would implement this using normal Scratch blocks. You could try something like this: ![](./assets/wait-until-something-true.svg) @@ -149,7 +137,7 @@ To demonstrate this, we can write an extension similar to Scratch's "when timer {require("!raw-loader!@site/static/example-extensions/timer-reimplementation.js")} -Notice that we don't have to run startHats -- Scratch automatically runs startHats for each edge activated hat at the beginning of a frame. This lets you use edge activated hats in sandboxed extensions. You also should not use `shouldRestartExistingThreads: true` for edge-activated hats. +Notice that we don't have to run startHats -- Scratch automatically runs startHats for each edge activated hat at the beginning of a frame. You also should not use `shouldRestartExistingThreads: true` for edge-activated hats. To test this use a script like this: diff --git a/docs/development/extensions/hello-world.md b/docs/development/extensions/hello-world.md index 3009beba..3ba42009 100644 --- a/docs/development/extensions/hello-world.md +++ b/docs/development/extensions/hello-world.md @@ -14,7 +14,7 @@ The above is a standard component we will use for showing extension code. Make n If you're just using simple files to develop extensions, save this code into a file called "hello-world.js". If you're using a local HTTP server, save the code in a file called "hello-world.js" that the server will let you access. -Now, go to the TurboWarp editor, click on the add extension button (a + next to 2 blocks), scroll to the bottom of the Scratch section, and choose the "Custom Extension" option. Either enter the full URL to your local HTTP server or use one of the other tabs to select your file or paste in code. For now, **do not** check the "Run extension without sandbox" box. +Now, go to the TurboWarp editor, click on the add extension button (a + next to 2 blocks), scroll to the bottom of the Scratch section, and choose the "Custom Extension" option. Either enter the full URL to your local HTTP server or use one of the other tabs to select your file or paste in code. The menu will warn you to only load extensions from authors you trust. You wrote this one yourself, so it's fine. After a second, an extension named "It works!" should appear in the sidebar. If it doesn't appear, open up your developer tools and look for any warnings in the console. Some of the most common errors are: diff --git a/docs/development/extensions/introduction.md b/docs/development/extensions/introduction.md index 0d7cad4d..f56f9a1e 100644 --- a/docs/development/extensions/introduction.md +++ b/docs/development/extensions/introduction.md @@ -19,12 +19,11 @@ When people refer to "extensions", there are a few things they could be referrin | |Can access Scratch internals|Can be loaded by URL| |:-:|:-:|:-:| |Core extensions (pen, translate, etc.)|✅|❌| -|Sandboxed custom extensions|❌|✅| -|Unsandboxed custom extensions|✅|✅| +|Custom extensions|✅|✅| The documentation in these segments refers only to custom extensions. While core extensions share many fundamentals, the process of developing them is significantly different. See [getting started](../getting-started) as a starting point for building core extensions. -We will discuss the difference between sandboxed and unsandboxed extensions at [a later time](./unsandboxed). +In TurboWarp, custom extensions run directly on the page, with the same access to the page as TurboWarp itself. We will discuss what this means for your extensions at [a later time](./unsandboxed). ## Compatibility @@ -65,7 +64,7 @@ This starts a local HTTP server on http://localhost:8080/ in whatever folder you We will [eventually](./better-development-server) introduce the official development server, but we recommend starting with the most primitive setup possible for now. -For now, you should use a port **other than 8000**. We will talk more about this later, but currently we want the extensions you write to run in the sandbox. Extensions that run outside of the sandbox have some extra responsibilities that we will discuss [later](./unsandboxed). +Any port will work. We use 8080 in this tutorial because the [official development server](./better-development-server) we introduce later uses port 8000. To test that your server works, create a file called `hello-world.js` and put any text in it. Make sure you're able to read the contents of the file in your browser by visiting a link like [http://localhost:8080/hello-world.js](http://localhost:8080/hello-world.js). diff --git a/docs/development/extensions/sandbox.md b/docs/development/extensions/sandbox.md index 57be446b..1c1355b7 100644 --- a/docs/development/extensions/sandbox.md +++ b/docs/development/extensions/sandbox.md @@ -2,54 +2,31 @@ hide_table_of_contents: true --- -# What is the sandbox anyways? +# What happened to the sandbox? -There are two types of custom extensions: +Older versions of TurboWarp had two types of custom extensions: - - Sandboxed extensions - - Unsandboxed extensions + - Sandboxed extensions, which ran in an isolated `