UNPKG

@studyportals/sp-hs-misc

Version:

Miscellaneous code used in HouseStark's projects

31 lines 1.11 kB
import { Throttleable } from "../.."; import { Throttler } from "../utils/throttler.class"; class ThrottleableServiceLayerClient extends Throttler { get serviceLayerClient() { return this._serviceLayerClient; } constructor(serviceLayerClient) { super(); this._serviceLayerClient = serviceLayerClient; } get(path) { return this.createEnqueueAndObserveTaskProxyingOutcome(() => this.serviceLayerClient.get(path)); } getCached(path) { return this.createEnqueueAndObserveTaskProxyingOutcome(() => this.serviceLayerClient.getCached(path)); } createEnqueueAndObserveTaskProxyingOutcome(actionFn) { const task = this.createAndEnqueueTask(actionFn); return task.createObservingPromise(); } createAndEnqueueTask(actionFn) { const task = this.createTask(actionFn); this.enqueueTask(task); return task; } createTask(actionFn) { return new Throttleable(actionFn); } } export { ThrottleableServiceLayerClient }; //# sourceMappingURL=throttleable-service-layer-client.class.js.map