@iotize/tap
Version:
IoTize Device client for Javascript
42 lines (38 loc) • 1.81 kB
JavaScript
import { defineTapPropertyExtension, Tap } from '@iotize/tap';
import { KeepAliveEngine, DEFAULT_KEEP_ALIVE_PERIOD_MS } from '@iotize/tap/keep-alive';
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
const ɵ0 = (context) => {
return new KeepAliveEngine(context.tap, {
period: DEFAULT_KEEP_ALIVE_PERIOD_MS,
});
};
const _TAP_EXTENSION_KEEP_ALIVE_ = defineTapPropertyExtension('keepAlive', ɵ0);
/**
* @deprecated use keepAlive property instead
* @param this
*/
function getKeepAliveEngine() {
return this.keepAlive;
}
Tap.prototype.getKeepAliveEngine = getKeepAliveEngine;
function setupKeepAliveFromConfig() {
return __awaiter(this, void 0, void 0, function* () {
const periodInSeconds = (yield this.service.interface.getHostInactivityPeriod()).body();
this.keepAlive.period = periodInSeconds * 1000;
this.keepAlive.start();
});
}
Tap.prototype.setupKeepAliveFromConfig = setupKeepAliveFromConfig;
/**
* Generated bundle index. Do not edit.
*/
export { _TAP_EXTENSION_KEEP_ALIVE_, getKeepAliveEngine, setupKeepAliveFromConfig };
//# sourceMappingURL=iotize-tap-ext-keep-alive.js.map