@zum/flash-client
Advanced tools
Comparing version 0.0.25 to 0.0.26
@@ -1,2 +0,4 @@ | ||
export {}; | ||
import { driverBusReportResponseObservable, getDriverBusReport } from './types/dbr'; | ||
export declare const subscribeDriverBusReports: <T>(driverBusReportIds: string[], getDriverBusReport: getDriverBusReport<T>) => driverBusReportResponseObservable<T>; | ||
export declare const unsubscribeDriverBusReports: () => Promise<void>; | ||
//# sourceMappingURL=dbr.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const initializer_1 = require("../init/initializer"); | ||
exports.unsubscribeDriverBusReports = exports.subscribeDriverBusReports = void 0; | ||
const rxjs_1 = require("rxjs"); | ||
const operators_1 = require("rxjs/operators"); | ||
const initializer_1 = require("../init/initializer"); | ||
const topicTypes_1 = require("../topic/topicTypes"); | ||
@@ -31,5 +32,7 @@ const throttleConfig = { | ||
}; | ||
exports.subscribeDriverBusReports = subscribeDriverBusReports; | ||
const unsubscribeDriverBusReports = () => { | ||
return (0, initializer_1.getSubscriptionManager)().unsubscribeTopic(topicTypes_1.FlashTopic.DRIVER_BUS_REPORT); | ||
}; | ||
exports.unsubscribeDriverBusReports = unsubscribeDriverBusReports; | ||
//# sourceMappingURL=dbr.js.map |
@@ -1,7 +0,7 @@ | ||
import {getSubscriptionManager} from "../init/initializer"; | ||
import {FlashEvent} from "../../connect/types"; | ||
import {driverBusReportResponseObservable, getDriverBusReport} from "./types/dbr"; | ||
import { asyncScheduler, merge, Observable, Subject } from 'rxjs'; | ||
import { filter, map, switchMap, throttleTime } from 'rxjs/operators'; | ||
import {FlashTopic} from "../topic/topicTypes"; | ||
import { FlashEvent } from '../../connect/types'; | ||
import { getSubscriptionManager } from '../init/initializer'; | ||
import { FlashTopic } from '../topic/topicTypes'; | ||
import { driverBusReportResponseObservable, getDriverBusReport } from './types/dbr'; | ||
@@ -14,9 +14,14 @@ const throttleConfig = { | ||
const subscribeDriverBusReports = <T>( | ||
export const subscribeDriverBusReports = <T>( | ||
driverBusReportIds: string[], | ||
getDriverBusReport: getDriverBusReport<T>, | ||
): driverBusReportResponseObservable<T> => { | ||
const driverBusReportsObservable = getSubscriptionManager().subscribe(FlashTopic.DRIVER_BUS_REPORT, driverBusReportIds); | ||
const driverBusReportsObservable = getSubscriptionManager().subscribe( | ||
FlashTopic.DRIVER_BUS_REPORT, | ||
driverBusReportIds, | ||
); | ||
const driverBusReportsObservableSubject = new Subject<FlashEvent>(); | ||
const driverBusReportsObservableSubscription = driverBusReportsObservable.subscribe(driverBusReportsObservableSubject); | ||
const driverBusReportsObservableSubscription = driverBusReportsObservable.subscribe( | ||
driverBusReportsObservableSubject, | ||
); | ||
@@ -28,3 +33,3 @@ const DBRObservableArray: driverBusReportResponseObservable<T>[] = driverBusReportIds.map((driverBusReportId) => { | ||
switchMap((event: FlashEvent) => { | ||
return getDriverBusReport({driverBusReportId: event.entityId}).pipe( | ||
return getDriverBusReport({ driverBusReportId: event.entityId }).pipe( | ||
map((driverBusReport: T) => { | ||
@@ -48,4 +53,4 @@ return { driverBusReportId: event.entityId, result: driverBusReport }; | ||
const unsubscribeDriverBusReports = (): Promise<void> => { | ||
export const unsubscribeDriverBusReports = (): Promise<void> => { | ||
return getSubscriptionManager().unsubscribeTopic(FlashTopic.DRIVER_BUS_REPORT); | ||
}; |
import { Observable } from 'rxjs'; | ||
export type getDriverBusReport<T> = (request: {driverBusReportId: string}) => Observable<T>; | ||
export type getDriverBusReport<T> = (request: { driverBusReportId: string }) => Observable<T>; | ||
export type driverBusReportResponseObservable<T> = Observable<{ driverBusReportId: string; result: T }>; |
@@ -8,3 +8,3 @@ export enum FlashTopic { | ||
TASK_LIST = 'TASK_LIST', | ||
DRIVER_BUS_REPORT = 'DRIVER_BUS_REPORT' | ||
DRIVER_BUS_REPORT = 'DRIVER_BUS_REPORT', | ||
} |
{ | ||
"name": "@zum/flash-client", | ||
"version": "0.0.25", | ||
"version": "0.0.26", | ||
"description": "Client for connecting to Zum Flash server", | ||
@@ -5,0 +5,0 @@ "license": "UNLICENSED", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
132422
1095