@microsoft/fast-element > SubscriberSet
SubscriberSet class
An implementation of Notifier that efficiently keeps track of subscribers interested in a specific change notification on an observable source.
Signature:export declare class SubscriberSet implements Notifier
Remarks
This set is optimized for the most common scenario of 1 or 2 subscribers. With this in mind, it can store a subscriber in an internal field, allowing it to avoid Array#push operations. If the set ever exceeds two subscribers, it upgrades to an array automatically.
Constructors
Constructor | Modifiers | Description |
---|---|---|
(constructor)(source, initialSubscriber) | Creates an instance of SubscriberSet for the specified source. |
Properties
Property | Modifiers | Type | Description |
---|---|---|---|
source | any | The source that this subscriber set is reporting changes for. |
Methods
Method | Modifiers | Description |
---|---|---|
has(subscriber) | Checks whether the provided subscriber has been added to this set. | |
notify(args) | Notifies all subscribers. | |
subscribe(subscriber) | Subscribes to notification of changes in an object's state. | |
unsubscribe(subscriber) | Unsubscribes from notification of changes in an object's state. |