···11+Permission is hereby granted, free of charge, to any person obtaining a copy
22+of this software and associated documentation files (the "Software"), to deal
33+in the Software without restriction, including without limitation the rights
44+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
55+copies of the Software, and to permit persons to whom the Software is
66+furnished to do so, subject to the following conditions:
77+88+The above copyright notice and this permission notice shall be included in all
99+copies or substantial portions of the Software.
1010+1111+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1212+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1313+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1414+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1515+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1616+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1717+SOFTWARE.
+37
README.md
···11+# signals
22+33+Fast reactive signals.
44+55+```ts
66+const name = signal(`Mary`);
77+88+// Run a side effect that gets rerun on state changes...
99+effect(() => {
1010+ console.log(`Hello, ${name.value}!`);
1111+});
1212+// logs `Hello, Mary!`
1313+1414+// Combine multiple writes into a single update...
1515+batch(() => {
1616+ name.value = `Elly`;
1717+ name.value = `Alice!`;
1818+});
1919+// logs `Hello, Alice!`
2020+2121+// Run derivations that only gets updated as needed when not depended on...
2222+const doubled = computed(() => {
2323+ console.log(`Computation ran!`);
2424+ return name.repeat(2);
2525+});
2626+2727+doubled.value;
2828+// logs `Computation ran!`
2929+// -> `AliceAlice`
3030+3131+name.value = `Alina`;
3232+// no logs as it's not being read under an effect yet!
3333+3434+doubled.value;
3535+// logs `Computation ran!`
3636+// -> `AlinaAlina`
3737+```