nope-js-browser
Version:
NoPE Runtime for the Browser. For nodejs please use nope-js-node
83 lines (82 loc) • 3.79 kB
TypeScript
/**
* @author Martin Karkowski
* @email m.karkowski@zema.de
* @create date 2021-11-12 12:25:30
* @modify date 2022-01-06 09:54:40
* @desc [description]
*/
import { IDataPubSubSystem, IEventAdditionalData, INopeObservable, INopeTopicWithDirectAccess, ITopicSetContentOptions } from "../types/nope/index";
import { PubSubSystemBase } from "./nopePubSubSystem";
/**
* Default implementation of {@link IDataPubSubSystem}
*
* Extends the {@link PubSubSystemBase} by adding the following properties and methods:
* - `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.
* - If you want to acces the root data please check the property `data` which will contain the entire data root that has been created.
*/
export declare class DataPubSubSystem extends PubSubSystemBase<ITopicSetContentOptions, INopeObservable, INopeTopicWithDirectAccess> implements IDataPubSubSystem {
/**
* A Getter to return a COPY of the item. Outside of the system,
* you'll never receive the original object. It is allways a clone.
*
*
* @author M.Karkowski
* @readonly
* @type {unknown}
* @memberof PubSubSystemBase
*/
get data(): unknown;
/**
* Option to push data into the system see {@link IDataPubSubSystem.pushData} @ {@link IDataPubSubSystem}
* @param path The path of the data.
* @param content The content of the Data.
* @param options The options used during pushing the data (see {@link IEventAdditionalData})
* @returns nothing.
*/
pushData<T = unknown>(path: string, content: T, options?: Partial<IEventAdditionalData>): void;
/**
* Option to pull data from the system see {@link IDataPubSubSystem.pullData} @ {@link IDataPubSubSystem}
* @param topic the Topic to use.
* @param _default The default object, if nothing else is provided
* @returns The data. Defined as T
*/
pullData<T = unknown, D = null>(topic: string, _default?: D): T;
/**
* Option to pull data from the system with a pattern see {@link IDataPubSubSystem.patternbasedPullData} @ {@link IDataPubSubSystem}
* @param pattern The pattern (see {@link })
* @param _default The Default object, if data is not present.
* @returns
*/
patternbasedPullData<T = unknown, D = null>(pattern: string, _default?: D): {
path: string;
data: T;
}[];
/**
* Option to push data to the system using a pattern see {@link IDataPubSubSystem.patternBasedPush} @ {@link IDataPubSubSystem}
* @param pattern The pattern (see {@link })
* @param data The data to push
* @param options The options used during pushing the data (see {@link IEventAdditionalData})
* @param fast If enabled, firstly, the data is pushed, afterwards, we just inform once.
* @returns Nothing
*/
patternBasedPush<T = unknown>(pattern: string, data: T, options?: Partial<IEventAdditionalData>, fast?: boolean): void;
protected _sendCurrentDataOnSubscription: boolean;
/**
* Describes the Data.
* @returns
*/
toDescription(): {
data: unknown;
publishers: {
name: string;
schema: import("../types/nope/nopeDescriptor.interface").INopeDescriptor;
}[];
subscribers: {
name: string;
schema: import("../types/nope/nopeDescriptor.interface").INopeDescriptor;
}[];
};
}