Adapting formats

This commit is contained in:
Martin Karkowski 2021-08-30 06:40:51 +02:00
parent f073782035
commit ce66d18fc0
6 changed files with 448 additions and 242 deletions

File diff suppressed because it is too large Load Diff

View File

@ -2,9 +2,30 @@
* @author Martin Karkowski
* @email m.karkowski@zema.de
* @create date 2021-08-04 15:46:01
* @modify date 2021-08-04 15:46:01
* @modify date 2021-08-27 20:23:38
* @desc [description]
*/
export * as communcation from "./communication/index.browser";
import "reflect-metadata";
import * as communcation from "./communication/index.browser";
import * as dispatcher from "./dispatcher/index";
import * as helpers from "./helpers/index.browser";
import * as loader from "./loader/index.browser";
import * as logger from "./logger/index.browser";
import * as modules from "./module/index";
import * as observables from "./observables/index";
import * as promises from "./promise/index";
import * as types from "./types/index";
export * from "./logger/index.browser";
export {
communcation,
dispatcher,
helpers,
loader,
logger,
types,
modules,
observables,
promises
};

View File

@ -2,10 +2,34 @@
* @author Martin Karkowski
* @email m.karkowski@zema.de
* @create date 2021-08-04 15:46:01
* @modify date 2021-08-04 15:47:56
* @modify date 2021-08-27 20:23:34
* @desc [description]
*/
export { readInArgs as readInRunArgs, runNopeBackend } from "./cli/runNopeBackend";
export * as communcation from "./communication/index.nodejs";
import "reflect-metadata";
import * as communcation from "./communication/index.nodejs";
import * as dispatcher from "./dispatcher/index";
import * as helpers from "./helpers/index.nodejs";
import * as loader from "./loader/index.nodejs";
import * as logger from "./logger/index.nodejs";
import * as modules from "./module/index";
import * as observables from "./observables/index";
import * as promises from "./promise/index";
import * as types from "./types/index";
export {
readInArgs as readInRunNopeBackendArgs,
runNopeBackend
} from "./cli/runNopeBackend";
export * from "./logger/index.nodejs";
export {
communcation,
dispatcher,
helpers,
loader,
logger,
types,
modules,
observables,
promises
};

View File

@ -30,7 +30,8 @@ import {
* - enables performing a subscription with synced call or a immediate call.
*/
export class NopeObservable<T, S = T, G = T>
implements INopeObservable<T, S, G> {
implements INopeObservable<T, S, G>
{
public observable: BehaviorSubject<G> = new BehaviorSubject<G>(undefined);
public readonly id: string = generateId();
@ -87,7 +88,7 @@ export class NopeObservable<T, S = T, G = T>
this._value = adapted.data;
} else {
// Adapt the Value if required.
this._value = (value as any) as T;
this._value = value as any as T;
}
const valueToPublish = this.getContent();
@ -205,7 +206,7 @@ export class NopeObservable<T, S = T, G = T>
*/
public getContent(): G | null {
if (this.getter !== null) return this.getter(this._value);
return (this._value as any) as G;
return this._value as any as G;
}
/**
@ -311,7 +312,7 @@ export class NopeObservable<T, S = T, G = T>
pipe?: IPipe<T | G, K>;
} = {}
): Subscription {
let observable: Observable<K> = (this as any) as Observable<K>;
let observable: Observable<K> = this as any as Observable<K>;
if (options.pipe) {
observable = options.pipe(options.scope, this.observable);
@ -357,7 +358,8 @@ export class NopeObservable<T, S = T, G = T>
* @param options Additional Options for the Wait Function.
*/
public waitFor(
testCallback: IwaitForCallback<G>,
testCallback: IwaitForCallback<G> = (value) =>
(value as any as boolean) == true,
options: INopeWaitForOpitions = { testCurrent: true }
): Promise<G> {
const _this = this;

View File

@ -1,6 +1,14 @@
export const DISPATCHER_INSTANCE = Symbol('nope.dispatcher.instance');
export const DISPATCHER_OPTIONS = Symbol('nope.dispatcher.options');
export const OBSERVABLE_FACTORY = Symbol('nope.observable.factory');
export const OBSERVABLE_INSTANCE = Symbol('nope.observable.instance');
export const COMMUNICATION_LAYER = Symbol('nope.communication.layer');
export const LOADER = Symbol('nope.package.loader');
/**
* @author Martin Karkowski
* @email m.karkowski@zema.de
* @create date 2021-08-27 20:31:42
* @modify date 2021-08-27 20:31:42
* @desc [description]
*/
export const DISPATCHER_INSTANCE = Symbol("nope.dispatcher.instance");
export const DISPATCHER_OPTIONS = Symbol("nope.dispatcher.options");
export const OBSERVABLE_FACTORY = Symbol("nope.observable.factory");
export const OBSERVABLE_INSTANCE = Symbol("nope.observable.instance");
export const COMMUNICATION_LAYER = Symbol("nope.communication.layer");
export const LOADER = Symbol("nope.package.loader");

View File

@ -205,7 +205,7 @@ export interface INopeObservable<T, S = T, G = T> {
* @param options Additional Options for the Wait Function.
*/
waitFor(
testCallback: IwaitForCallback<G>,
testCallback?: IwaitForCallback<G>,
options?: INopeWaitForOpitions
): Promise<G>;