UNPKG

@studyportals/sp-hs-misc

Version:

Miscellaneous code used in HouseStark's projects

35 lines 1.31 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ThrottleableServiceLayerClient = void 0; const __1 = require("../.."); const throttler_class_1 = require("../utils/throttler.class"); class ThrottleableServiceLayerClient extends throttler_class_1.Throttler { _serviceLayerClient; 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 __1.Throttleable(actionFn); } } exports.ThrottleableServiceLayerClient = ThrottleableServiceLayerClient; //# sourceMappingURL=throttleable-service-layer-client.class.js.map