nativescript-secure-storage
Version:
Secure Storage NativeScript plugin
49 lines • 1.65 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var applicationSettings = require("tns-core-modules/application-settings");
var SecureStorageCommon = (function () {
function SecureStorageCommon() {
this.isFirst = applicationSettings.getBoolean(SecureStorageCommon.IS_FIRST_RUN, true);
if (this.isFirst) {
applicationSettings.setBoolean(SecureStorageCommon.IS_FIRST_RUN, false);
}
}
SecureStorageCommon.prototype.isFirstRunSync = function () {
return this.isFirst;
};
SecureStorageCommon.prototype.isFirstRun = function () {
var _this = this;
return new Promise(function (resolve, reject) {
resolve(_this.isFirstRunSync());
});
};
SecureStorageCommon.prototype.clearAllOnFirstRun = function () {
var _this = this;
return new Promise(function (resolve, reject) {
if (_this.isFirstRunSync()) {
_this.removeAll();
resolve(true);
}
else {
resolve(false);
}
});
};
SecureStorageCommon.prototype.clearAllOnFirstRunSync = function () {
try {
if (this.isFirstRunSync()) {
this.removeAllSync();
return true;
}
return false;
}
catch (e) {
console.log(e);
return false;
}
};
SecureStorageCommon.IS_FIRST_RUN = "__IS_FIRST_RUN__";
return SecureStorageCommon;
}());
exports.SecureStorageCommon = SecureStorageCommon;
//# sourceMappingURL=secure-storage.common.js.map