correcting type
This commit is contained in:
parent
cf9c7af953
commit
d3f4f075e5
@ -291,7 +291,7 @@ export interface ITopicMatcher {
|
||||
export type observableCallback<T> = (content: T | null, sender: string, timeStamp: number | null, ...data) => void;
|
||||
export type waitForCallback<T> = (content?: T | null, sender?: string, timeStamp?: number | null, ...data) => boolean | Promise<boolean>;
|
||||
|
||||
export interface IObservable<T> {
|
||||
export interface IObservable<T,S = T,G = T> {
|
||||
|
||||
/**
|
||||
* The ID of the Observable
|
||||
@ -303,23 +303,20 @@ export interface IObservable<T> {
|
||||
*/
|
||||
type: 'observable';
|
||||
|
||||
|
||||
/**
|
||||
* Element containing the value.
|
||||
*/
|
||||
value: T | null;
|
||||
|
||||
_value: T | null;
|
||||
|
||||
/**
|
||||
* Stores the specified Setter internally
|
||||
*/
|
||||
setter: ((value: T | null, sender: string | null, timeStamp: number | null, ...data) => T | null) | null;
|
||||
setter: ((value: S | null, sender: string | null, timeStamp: number | null, ...data) => {
|
||||
data: T | null,
|
||||
valid: boolean,
|
||||
}) | null;
|
||||
|
||||
/**
|
||||
* Stores the specified Getter
|
||||
*/
|
||||
getter: ((value: T | null) => T | null) | null;
|
||||
getter: ((value: T | null) => G | null) | null;
|
||||
|
||||
/**
|
||||
* Function to Set the Value.
|
||||
@ -328,12 +325,12 @@ export interface IObservable<T> {
|
||||
* @param timeStamp A Timestamp which could be provided
|
||||
* @param data Additional Data
|
||||
*/
|
||||
setContent(value: T | null, sender?: string | null, timeStamp?: number | null, ...data): void;
|
||||
setContent(value: S | null, sender?: string | null, timeStamp?: number | null, ...data): void;
|
||||
|
||||
/**
|
||||
* A Default Getter, to get the coresponding Value.
|
||||
*/
|
||||
getContent(): T | null;
|
||||
getContent(): G | null;
|
||||
|
||||
/**
|
||||
* Creates a Subscription for the value of the Observable
|
||||
@ -356,14 +353,14 @@ export interface IObservable<T> {
|
||||
* @param testCallback Function which implements the Condition to Pass
|
||||
* @param options Additional Options.
|
||||
*/
|
||||
waitFor(testCallback: waitForCallback<T>, options?: IWaitForOpitions): Promise<T>;
|
||||
waitFor(testCallback: waitForCallback<G>, options?: IWaitForOpitions): Promise<G>;
|
||||
|
||||
/**
|
||||
* Function to wait for an Update of the Data.
|
||||
* @param mode The mode
|
||||
* @param options Additional Options
|
||||
*/
|
||||
waitForUpdate(mode?: 'sync' | 'async', options?: ISubscriptionOptions): Promise<T>;
|
||||
waitForUpdate(mode?: 'sync' | 'async', options?: ISubscriptionOptions): Promise<G>;
|
||||
|
||||
/**
|
||||
* Forces Publishing an Update
|
||||
@ -389,11 +386,9 @@ export interface IObservable<T> {
|
||||
*/
|
||||
options: any;
|
||||
|
||||
subscriptions: Set<ISubscription<T>>;
|
||||
|
||||
dispose(): void;
|
||||
|
||||
observable: nopeObservable<T>;
|
||||
observable: nopeObservable<G>;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user