Skip to content

Commit

Permalink
fix(signals): Typos in README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
manzt committed Jun 29, 2024
1 parent 969bbfc commit 866f197
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
23 changes: 12 additions & 11 deletions packages/signals/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ Use [signals](https://github.com/tc39/proposal-signals) with
## Usage

```javascript
import { effect, signal } from "https://esm.sh/@preact/signals-core";
import { defineWidget } from "https://esm.sh/jsr/@anywidget/signals";
import { effect, signal } from "@preact/signals-core";
import { defineWidget } from "@anywidget/signals";

export default signalify(signal, {
render({ model, el }) {
Expand Down Expand Up @@ -41,8 +41,8 @@ class Counter(anywidget.Widget):
With `@preact/signals-core`:

```typescript
import { effect, signal } from "https://esm.sh/@preact/signals-core";
import { defineWidget } from "https://esm.sh/jsr/@anywidget/signals";
import { effect, signal } from "@preact/signals-core";
import { defineWidget } from "@anywidget/signals";

export default signalify(signal, {
render({ model, el }) {
Expand All @@ -59,10 +59,10 @@ export default signalify(signal, {
With `solid-js`:

```typescript
import { createEffect, createSignal } from "https://esm.sh/solid-js";
import { defineWidget } from "https://esm.sh/jsr/@anywidget/signals";
import { createEffect, createSignal } from "solid-js";
import { defineWidget } from "@anywidget/signals";

export default defineWidget(singal, {
export default defineWidget(createSignal, {
render({ model, el }) {
let btn = document.createElement("button");
btn.addEventListener("click", () => model.value += 1);
Expand All @@ -76,8 +76,9 @@ export default defineWidget(singal, {

Behind the scenes, `defineWidget` creates a _signal_ for each widget attribute.

> [!IMPORTANT] The `model` passed into the widget lifecycle methods is
> _different_ from the `model` without the signals bridge.
> [!IMPORTANT
> The `model` passed into the widget lifecycle methods is _different_ from the
> `model` without the signals bridge.
This `model` is special. In AFM, model state is normally accessed though `.get`
and `.set`/`.save_changes`. With the `@anywidget/signals` bridge, the state is
Expand All @@ -99,8 +100,8 @@ _compose_ signals with the effect system of your choice. For example, we can
create derived signals:

```typescript
import { signal, computed, effect } from "https://esm.sh/@preact/signals-core";
import { defineWidget } from "https://esm.sh/jsr/@anywidget/signals";
import { signal, computed, effect } from "@preact/signals-core";
import { defineWidget } from "@anywidget/signals";

export default defineWidget(signal, {
render({ model, el }) {
Expand Down
2 changes: 1 addition & 1 deletion packages/signals/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@anywidget/signals",
"version": "0.0.2",
"version": "0.0.3",
"description": "A stub-package for making releases of the jsr:@anywidget/signals with changesets",
"scripts": {
"prepublish": "mv README.md tmp.md && mv npm.README.md README.md",
Expand Down

0 comments on commit 866f197

Please sign in to comment.