TeamPlay signals come with a set of methods for interacting with the data they represent. These methods are available on all signals, whether they're created using $(), accessed through the root signal $, or returned by sub() or useSub().
Retrieves the current value of the signal.
Updates the value of the signal.
Note: set() is asynchronous and returns a Promise.
Deletes the value of the signal or removes an item from an array.
Note: del() is asynchronous and returns a Promise.
Adds a value to the end of an array signal.
Removes and returns the last item from an array signal.
Increments a numeric signal by the specified value (or by 1 if no value is provided).
Adds a new item to a collection signal, automatically generating a unique ID.
Assigns multiple properties to a signal at once. This method iterates through the object's own properties and sets or deletes them on the signal.
Behavior:
.set(value) on the child signal (adds property if it doesn't exist).del() on the child signalset(), del(), push(), pop(), increment(), add(), assign()) are asynchronous and return Promises. This ensures data consistency with the server.get() method is synchronous and returns the current local value of the signal.$.users[userId].name.set('New Name').