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
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
The default Publish and Subscribe System.
The System contains of
publishersandsubscriberswhich are linked usingtopics(based onstrings).publishersorsubscribersuse the function:registerand provide the required options (see register)subscriberyou can use the function :registerSubscriptionwhich will receive a topic and acallback(see registerSubscription)publishersorsubscribersyou can change the behavior usingupdateOptions(see updateOptions)publishersorsubscribersuseunregister(see unregister)emitdata useemit(see emit)publishersandsubscribersare present, checkout the corresponding properties.disposeit!The publisher might be
observabesoreventEmitters.The
IPubSubSystemis implemented by thePubSubSystemBase-ClassThe Behavior may differ based on the settings. Your are not able to change these options, after the instance has been created. (see IPubSubOptions for details) The Default of these options are settings are.
Example 1
Author
M.Karkowski
Export