26 lines
3.0 KiB
JavaScript
26 lines
3.0 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
const testcafe_safe_storage_1 = require("testcafe-safe-storage");
|
|
const DEFAULT_DASHBOARD_OPTIONS = {
|
|
token: '',
|
|
// NOTE: we should send reports to the dashboard until it is disabled explicitly
|
|
sendReport: true,
|
|
};
|
|
class DashboardConfigStorage {
|
|
constructor() {
|
|
this.options = {};
|
|
this._storage = new testcafe_safe_storage_1.SafeStorage();
|
|
}
|
|
async load() {
|
|
const result = await this._storage.tryLoad();
|
|
const storageExists = result !== void 0;
|
|
this.options = result || Object.assign({}, DEFAULT_DASHBOARD_OPTIONS);
|
|
return storageExists;
|
|
}
|
|
async save() {
|
|
await this._storage.save(this.options);
|
|
}
|
|
}
|
|
exports.default = DashboardConfigStorage;
|
|
module.exports = exports.default;
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uZmlnLXN0b3JhZ2UuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvZGFzaGJvYXJkL2NvbmZpZy1zdG9yYWdlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsaUVBQW9EO0FBR3BELE1BQU0seUJBQXlCLEdBQW9CO0lBQy9DLEtBQUssRUFBRSxFQUFFO0lBRVQsZ0ZBQWdGO0lBQ2hGLFVBQVUsRUFBRSxJQUFJO0NBQ25CLENBQUM7QUFFRixNQUFxQixzQkFBc0I7SUFJdkM7UUFDSSxJQUFJLENBQUMsT0FBTyxHQUFJLEVBQUUsQ0FBQztRQUNuQixJQUFJLENBQUMsUUFBUSxHQUFHLElBQUksbUNBQVcsRUFBbUIsQ0FBQztJQUN2RCxDQUFDO0lBRU0sS0FBSyxDQUFDLElBQUk7UUFDYixNQUFNLE1BQU0sR0FBVSxNQUFNLElBQUksQ0FBQyxRQUFRLENBQUMsT0FBTyxFQUFtQixD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