mirror of
https://github.com/sern-handler/handler
synced 2026-06-06 01:16:55 +00:00
chore(core): update imports and operators
This commit is contained in:
@@ -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';
|
||||
|
||||
@@ -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<VoidResult, boolean> = pipe(
|
||||
every(result => result.ok),
|
||||
defaultIfEmpty(true),
|
||||
);
|
||||
|
||||
export const sharedObservable = <T>(e: EventEmitter, eventName: string) => {
|
||||
return (fromEvent(e, eventName) as Observable<T>).pipe(share())
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user