UNPKG

@addapptables/ng-signal-r

Version:
92 lines (87 loc) 2.81 kB
import { __awaiter, __generator } 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 */ var SignalRAdapter = /** @class */ (function () { function SignalRAdapter() { } /** * @param {?} url * @param {?=} options * @return {?} */ SignalRAdapter.prototype.connect = /** * @param {?} url * @param {?=} options * @return {?} */ function (url, options) { return __awaiter(this, void 0, void 0, function () { var connection; return __generator(this, function (_a) { switch (_a.label) { case 0: connection = new HubConnectionBuilder() .withUrl(url, options) .build(); return [4 /*yield*/, connection.start()]; case 1: _a.sent(); return [2 /*return*/, connection]; } }); }); }; /** * @param {?} connection * @param {?} event * @param {?} callFunction * @return {?} */ SignalRAdapter.prototype.bindEvent = /** * @param {?} connection * @param {?} event * @param {?} callFunction * @return {?} */ function (connection, event, callFunction) { connection.on(event, callFunction); }; /** * @param {?} connection * @return {?} */ SignalRAdapter.prototype.disconnect = /** * @param {?} connection * @return {?} */ function (connection) { return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, connection.stop()]; case 1: _a.sent(); return [2 /*return*/]; } }); }); }; SignalRAdapter.decorators = [ { type: Injectable } ]; return SignalRAdapter; }()); /** * @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