UNPKG

@addapptables/ng-signal-r

Version:
60 lines (55 loc) 1.78 kB
import { __awaiter } from 'tslib'; import { HubConnectionBuilder } from '@aspnet/signalr'; import { Injectable } from '@angular/core'; /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ class SignalRAdapter { /** * @param {?} url * @param {?=} options * @return {?} */ connect(url, options) { return __awaiter(this, void 0, void 0, /** @this {!SignalRAdapter} */ function* () { /** @type {?} */ const connection = new HubConnectionBuilder() .withUrl(url, options) .build(); yield connection.start(); return connection; }); } /** * @param {?} connection * @param {?} event * @param {?} callFunction * @return {?} */ bindEvent(connection, event, callFunction) { connection.on(event, callFunction); } /** * @param {?} connection * @return {?} */ disconnect(connection) { return __awaiter(this, void 0, void 0, /** @this {!SignalRAdapter} */ function* () { yield connection.stop(); }); } } SignalRAdapter.decorators = [ { type: Injectable } ]; /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ export { SignalRAdapter }; //# sourceMappingURL=addapptables-ng-signal-r.js.map