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
publishers
andsubscribers
which are linked usingtopics
(based onstrings
).publishers
orsubscribers
use the function:register
and provide the required options (see register)subscriber
you can use the function :registerSubscription
which will receive a topic and acallback
(see registerSubscription)publishers
orsubscribers
you can change the behavior usingupdateOptions
(see updateOptions)publishers
orsubscribers
useunregister
(see unregister)emit
data useemit
(see emit)publishers
andsubscribers
are present, checkout the corresponding properties.dispose
it!The publisher might be
observabes
oreventEmitters
.The
IPubSubSystem
is 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