move registration.js to ts

This commit is contained in:
Audric Ackermann 2022-03-23 14:26:46 +11:00
parent 0d4059ccb1
commit 6334f7cb45
No known key found for this signature in database
GPG key ID: 999F434D76324AD4
3 changed files with 22 additions and 28 deletions

View file

@ -107,6 +107,7 @@
// Ensure accounts created prior to 1.0.0-beta8 do have their
// 'primaryDevicePubKey' defined.
if (Whisper.Registration.isDone() && !storage.get('primaryDevicePubKey', null)) {
storage.put(
'primaryDevicePubKey',

View file

@ -1,28 +0,0 @@
/* global storage, Whisper */
// eslint-disable-next-line func-names
(function() {
'use strict';
Whisper.Registration = {
markEverDone() {
storage.put('chromiumRegistrationDoneEver', '');
},
markDone() {
this.markEverDone();
storage.put('chromiumRegistrationDone', '');
},
isDone() {
return storage.get('chromiumRegistrationDone') === '';
},
everDone() {
return (
storage.get('chromiumRegistrationDoneEver') === '' ||
storage.get('chromiumRegistrationDone') === ''
);
},
remove() {
storage.remove('chromiumRegistrationDone');
},
};
})();

21
ts/util/registration.ts Normal file
View file

@ -0,0 +1,21 @@
function markEverDone() {
storage.put('chromiumRegistrationDoneEver', '');
}
function markDone() {
this.markEverDone();
storage.put('chromiumRegistrationDone', '');
}
function isDone() {
return storage.get('chromiumRegistrationDone') === '';
}
function everDone() {
return (
storage.get('chromiumRegistrationDoneEver') === '' ||
storage.get('chromiumRegistrationDone') === ''
);
}
function remove() {
storage.remove('chromiumRegistrationDone');
}
export const Registration = { markEverDone, markDone, isDone, everDone, remove };