![Logo](/_astro/logo.DNC1PCTe_Z1abT04.webp)
ctrl+k
Enter a search term above to see results...
Enter a search term above to see results...
Number Helpers are methods available on Signal instances that contain numeric values. These helpers provide convenient ways to manipulate and update numeric signals.
Increases the value of the Signal by a specified amount or by 1 if no amount is provided.
signal.increment(amount)
Name | Type | Description |
---|---|---|
amount | Number | (Optional) The amount to increment by. Defaults to 1 if not specified. |
import { Signal } from '@semantic-ui/reactivity';
const counter = new Signal(0);
counter.increment();console.log(counter.get()); // Output: 1
counter.increment(5);console.log(counter.get()); // Output: 6
Decreases the value of the Signal by a specified amount or by 1 if no amount is provided.
signal.decrement(amount)
Name | Type | Description |
---|---|---|
amount | Number | (Optional) The amount to decrement by. Defaults to 1 if not specified. |
import { Signal } from '@semantic-ui/reactivity';
const counter = new Signal(10);
counter.decrement();console.log(counter.get()); // Output: 9
counter.decrement(3);console.log(counter.get()); // Output: 6