From 52b186cc4438efb775d345bde246810eb2a13453 Mon Sep 17 00:00:00 2001 From: Jacob Nguyen <76754747+jacoobes@users.noreply.github.com> Date: Tue, 2 May 2023 10:27:53 -0500 Subject: [PATCH] chore(core): update imports and operators --- src/core/index.ts | 8 ++++++-- src/core/operators.ts | 10 +++++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/core/index.ts b/src/core/index.ts index e036b5d..f6facb2 100644 --- a/src/core/index.ts +++ b/src/core/index.ts @@ -1,3 +1,7 @@ -import SernEmitter from './sernEmitter' -export * from './operators' +import SernEmitter from './sernEmitter'; +export * from './operators'; +export * from './dependencies'; export { SernEmitter }; +export * from './contracts'; +export * from './platform'; +export * from './plugins'; diff --git a/src/core/operators.ts b/src/core/operators.ts index 5b355bd..97477c7 100644 --- a/src/core/operators.ts +++ b/src/core/operators.ts @@ -4,12 +4,13 @@ * and independent of each other */ -import { concatMap, defaultIfEmpty, EMPTY, every, map, of, OperatorFunction, pipe } from 'rxjs'; +import { concatMap, defaultIfEmpty, EMPTY, every, fromEvent, map, Observable, of, OperatorFunction, pipe, share } from 'rxjs'; import type { AnyModule } from '../types/module'; import { nameOrFilename } from './utilities/functions'; import type { PluginResult, VoidResult } from '../types/plugin'; import { Result } from 'ts-results-es'; import { ImportPayload } from '../types/handler'; +import { EventEmitter } from 'node:events'; /** * if {src} is true, mapTo V, else ignore * @param item @@ -73,3 +74,10 @@ export const everyPluginOk: OperatorFunction = pipe( every(result => result.ok), defaultIfEmpty(true), ); + +export const sharedObservable = (e: EventEmitter, eventName: string) => { + return (fromEvent(e, eventName) as Observable).pipe(share()) +}; + + +