Readonly
dataA Getter to return a COPY of the item. Outside of the system, you'll never receive the original object.
M.Karkowski
IPubSubSystem
Readonly
emittersList all known Emitters in the System.
Readonly
onAn observable which holds the incremental data change. this will be triggered, if the an emitter (publisher) changes its data. Contains only the last emitted data and the topic
// Describe the required Test:
let pubSubSystem = new PubSubSystemBase({
generateEmitterType: function () {
return new NopeEventEmitter() as INopeEventEmitter;
},
});
// Create a Publisher for the system:
let publisher: INopeEventEmitter = new NopeEventEmitter();
pubSubSystem.register(publisher, {
mode: "publish",
schema: {},
topic: "this/is/a/test",
});
pubSubSystem.onIncrementalDataChange.subscribe(console.log);
publisher.emit("Hello World!"); // Logs the following => {path: "this/is/a/test", data: "Hello World!"}
M.Karkowski
IPubSubSystem
Readonly
optionsOptions which describe the Behavior
M.Karkowski
IPubSubSystem
Readonly
publishersList containing all publishers.
M.Karkowski
IPubSubSystem
Readonly
subscriptionsList, containing all subscribers.
M.Karkowski
IPubSubSystem
Pushes data to the elements, where the pattern matches.
M.Karkowski
IDataPubSubSystem
The pattern, which should be used to forward the data. For valid patterns see pattern
The content to store in the given path.
A Pattern based Pull. You can provide a mqtt based pattern and receive an array which contains all the data which matches the topic.
M.Karkowski
{{ path: string, data: T }[]}
IPubSubSystem
The pattern to pull the data from
a default value, o
Pull some Data of System. You will allways receive a just a copy. This method prevents you to use a pattern like path. If you want to use patterns please use the "patternbasedPullData"
M.Karkowski
The Expected Type
IPubSubSystem
Expected Type of the return. Defaults to unkown
Default Value.
If no data is found => return the default data.
Function, to push data. Every subscriber will be informed, if pushing the data on the given path will affect the subscribers.
M.Karkowski
IPubSubSystem
Type which is pushed
The Path, on which the data should be changed
The content to store in the given path.
Optional
options: Partial<IEventAdditionalData>The Options, that will be forwarded to subscribers.
Function to register an Observable. Please define the Options, to decide whether the data of the observable should be published or subscribed.
M.Karkowski
{O}
IPubSubSystem
The Emitter to consider
A Helper, that allows the user to subscribe to changes. Therfore he must transmit
M.Karkowski
{INopeObserver}
IPubSubSystem
Expected Type of the content
The
Lists all publishers and subscribers of the system.
Helper to manually Trigger an update of the Matching. This will update subscribers and publishers and link them. Normally this is not necessary.
This will build an internal linking (based on the settings) between publishers and subscribers.
M.Karkowski
IPubSubSystem
Function to update the options and there by the topics of an observable.
M.Karkowski
IPubSubSystem
The Emitter to consider
The modified options
Generated using TypeDoc
A data-based Publish and Subscribe system. Extends IPubSubSystem by providing the the methods and properties:
pushData
to push data into the system.pullData
to pull data from the system. Will allways return the current data or the default value if no data is present at the given path.patternbasedPullData
to pull data with a given pattern. See the example for details.patternBasedPush
to push data with a given pattern into the system.Author
M.Karkowski
Export