Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
abhishiv committed Aug 29, 2024
1 parent ffebbbf commit 1249f58
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,11 @@ const [count, setCount] = signal("count", 0);

count(); // Passive read (read-pass)
setCount(1); // Write

// also possible to use get/set on signal instead of tuples
const $count = signal("count", 0);
$count.get();
$count.set(5);
```

The subscribers to signals are wires, which will be introduced later. They subscribe by read-subscribing the signal.
Expand Down Expand Up @@ -391,8 +396,9 @@ These are task runners who subscribe to signals/stores and react to writes. They

```tsx
wire(($) => {
// Explicitly subscribe to count signal using the subtoken "$"
const countValue = $(count); // or count($)
// Explicitly subscribe to count getter using the subtoken "$"
const [count, setCount] = signal("count", 4);
const countValue = $(count);

// also possible to subscribe to a stores using "$" subtoken
const friendsCount = $($profile.friends);
Expand Down

0 comments on commit 1249f58

Please sign in to comment.