making it work.

This commit is contained in:
fiatjaf
2022-01-10 15:55:48 -03:00
parent 88a2dd806d
commit 233aaa0f8f
7 changed files with 1082 additions and 24 deletions

View File

@@ -2,14 +2,26 @@
import browser from 'webextension-polyfill'
document.getElementById('privateKeyInput').addEventListener('input', ev => {
browser.storage.local
.set({private_key: document.getElementById('privateKeyInput').value})
.then(() => {
console.log('success')
})
})
document
.getElementById('privateKeyInput')
.addEventListener('input', async ev => {
try {
await browser.storage.local.set({
private_key: document.getElementById('privateKeyInput').value
})
showMessage('saved!')
} catch (err) {
showMessage(`error! ${err}`)
}
})
browser.storage.local.get('private_key').then(results => {
document.getElementById('privateKeyInput').value = results.private_key
})
function showMessage(str) {
document.getElementById('message').innerHTML = str
setTimeout(() => {
document.getElementById('message').innerHTML = ''
}, 5000)
}