@tdb/util
Version:
Shared helpers and utilities.
61 lines • 2.22 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var constants_1 = require("../../constants");
function init() {
if (constants_1.IS_BROWSER) {
var store_1 = window.localStorage;
return {
getItem: function (key) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
return tslib_1.__generator(this, function (_a) {
return [2, store_1.getItem(key)];
});
});
},
setItem: function (key, value) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
return tslib_1.__generator(this, function (_a) {
store_1.setItem(key, value);
return [2];
});
});
},
removeItem: function (key) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
return tslib_1.__generator(this, function (_a) {
store_1.removeItem(key);
return [2];
});
});
},
};
}
else {
return {
getItem: function () {
return tslib_1.__awaiter(this, void 0, void 0, function () {
return tslib_1.__generator(this, function (_a) {
return [2, undefined];
});
});
},
setItem: function () {
return tslib_1.__awaiter(this, void 0, void 0, function () {
return tslib_1.__generator(this, function (_a) {
return [2, undefined];
});
});
},
removeItem: function () {
return tslib_1.__awaiter(this, void 0, void 0, function () {
return tslib_1.__generator(this, function (_a) {
return [2, undefined];
});
});
},
};
}
}
exports.init = init;
//# sourceMappingURL=store.web.js.map