Check out this code snippet from the open-source project Thingsboard.
import { forkJoin, of } from 'rxjs';
...
import { catchError, map, mergeMap, switchMap } from 'rxjs/operators';
...
export class WidgetContext {
...
rxjs = {
forkJoin,
of,
map,
mergeMap,
switchMap,
catchError
};
...
}
The purpose of this code is to allow developers to easily call listed RxJS operators from custom widget code.
self.ctx.rxjs.switchMap(...);
Now, I have a question:
Is there a way to re-export all available RxJS operators without manually listing them?