Skip to content

Commit

Permalink
convert edits (#1580)
Browse files Browse the repository at this point in the history
* alsos

* above

* mutable

* more edits

---------

Co-authored-by: Mike Bostock <[email protected]>
  • Loading branch information
Fil and mbostock authored Aug 18, 2024
1 parent b1d0719 commit d298eac
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docs/convert.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ Should be converted to:
import.meta.resolve("npm:regl")
```

Since notebooks also support [dynamic import](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import), you might also see libraries being loaded from CDNs such as [jsDelivr](https://www.jsdelivr.com/esm) or [esm.sh](https://esm.sh/). While you can use dynamic imports in Framework, for security and performance, we recommend also converting these into static imports. So this:
Some notebooks use [dynamic import](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import) to load libraries from npm-backed CDNs such as [jsDelivr](https://www.jsdelivr.com/esm) and [esm.sh](https://esm.sh/). While you can use dynamic imports in Framework, for security and performance, we recommend converting these into static imports. So this:

```js run=false
isoformat = import("https://esm.sh/isoformat")
Expand Down Expand Up @@ -253,7 +253,7 @@ const foo = (function* () {

<div class="note">

Since variables are evaluated lazily, the generator `foo` will only run above if it is referenced by another code block. If you want to perform asynchronous side effects, consider using an animation loop and the [invalidation promise](./reactivity#invalidation) instead of a generator.
Since variables are evaluated lazily, the generator `foo` above will only run if it is referenced by another code block. If you want to perform asynchronous side effects, consider using an animation loop and the [invalidation promise](./reactivity#invalidation) instead of a generator.

</div>

Expand Down Expand Up @@ -290,7 +290,7 @@ const foo = Mutable(42);
const setFoo = (x) => (foo.value = x);
```

Then replace any assignments to `mutable foo` with calls to `setFoo`.
Then replace any assignments to `mutable foo` with calls to `setFoo`. Note that `setFoo` must be declared in the same code block as `foo`, and that outside of that block, `foo` represents the value; any code that depends on `foo` will update reactively after `setFoo` is invoked.

## Standard library

Expand Down

0 comments on commit d298eac

Please sign in to comment.