chore: format and lint
This commit is contained in:
@@ -11,7 +11,7 @@ window.nostr = {
|
||||
},
|
||||
|
||||
async signEvent(event) {
|
||||
return this._call('signEvent', {event})
|
||||
return this._call('signEvent', { event })
|
||||
},
|
||||
|
||||
async getRelays() {
|
||||
@@ -20,16 +20,16 @@ window.nostr = {
|
||||
|
||||
nip04: {
|
||||
async encrypt(peer, plaintext) {
|
||||
return window.nostr._call('nip04.encrypt', {peer, plaintext})
|
||||
return window.nostr._call('nip04.encrypt', { peer, plaintext })
|
||||
},
|
||||
|
||||
async decrypt(peer, ciphertext) {
|
||||
return window.nostr._call('nip04.decrypt', {peer, ciphertext})
|
||||
return window.nostr._call('nip04.decrypt', { peer, ciphertext })
|
||||
}
|
||||
},
|
||||
|
||||
_call(type, params) {
|
||||
let id = Math.random().toString().slice(-4)
|
||||
const id = Math.random().toString().slice(-4)
|
||||
console.log(
|
||||
'%c[nostrconnect:%c' +
|
||||
id +
|
||||
@@ -46,7 +46,7 @@ window.nostr = {
|
||||
'font-weight:bold;color:#90b12d;font-family:monospace'
|
||||
)
|
||||
return new Promise((resolve, reject) => {
|
||||
this._requests[id] = {resolve, reject}
|
||||
this._requests[id] = { resolve, reject }
|
||||
window.postMessage(
|
||||
{
|
||||
id,
|
||||
@@ -60,7 +60,7 @@ window.nostr = {
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener('message', message => {
|
||||
window.addEventListener('message', (message) => {
|
||||
if (
|
||||
!message.data ||
|
||||
message.data.response === null ||
|
||||
@@ -71,8 +71,8 @@ window.addEventListener('message', message => {
|
||||
return
|
||||
|
||||
if (message.data.response.error) {
|
||||
let error = new Error(
|
||||
`${EXTENSION}: ` + message.data.response.error.message
|
||||
const error = new Error(
|
||||
`${EXTENSION}: ${message.data.response.error.message}`
|
||||
)
|
||||
error.stack = message.data.response.error.stack
|
||||
window.nostr._requests[message.data.id].reject(error)
|
||||
@@ -104,7 +104,9 @@ async function replaceNostrSchemeLink(e) {
|
||||
if (e.target.tagName !== 'A' || !e.target.href.startsWith('nostr:')) return
|
||||
if (replacing === false) return
|
||||
|
||||
let response = await window.nostr._call('replaceURL', {url: e.target.href})
|
||||
const response = await window.nostr._call('replaceURL', {
|
||||
url: e.target.href
|
||||
})
|
||||
if (response === false) {
|
||||
replacing = false
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user