log command results.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "nos2x",
|
||||
"description": "Nostr Signer Extension",
|
||||
"version": "2.0.3",
|
||||
"version": "2.1.0",
|
||||
"homepage_url": "https://github.com/fiatjaf/nos2x",
|
||||
"manifest_version": 3,
|
||||
"icons": {
|
||||
|
||||
@@ -27,8 +27,23 @@ window.nostr = {
|
||||
},
|
||||
|
||||
_call(type, params) {
|
||||
let id = Math.random().toString().slice(-4)
|
||||
console.log(
|
||||
'%c[nos2x:%c' +
|
||||
id +
|
||||
'%c]%c calling %c' +
|
||||
type +
|
||||
'%c with %c' +
|
||||
JSON.stringify(params || {}),
|
||||
'background-color:#f1b912;font-weight:bold;color:white',
|
||||
'background-color:#f1b912;font-weight:bold;color:#a92727',
|
||||
'background-color:#f1b912;color:white;font-weight:bold',
|
||||
'color:auto',
|
||||
'font-weight:bold;color:#08589d;font-family:monospace',
|
||||
'color:auto',
|
||||
'font-weight:bold;color:#90b12d;font-family:monospace'
|
||||
)
|
||||
return new Promise((resolve, reject) => {
|
||||
let id = Math.random().toString().slice(4)
|
||||
this._requests[id] = {resolve, reject}
|
||||
window.postMessage(
|
||||
{
|
||||
@@ -61,6 +76,20 @@ window.addEventListener('message', message => {
|
||||
window.nostr._requests[message.data.id].resolve(message.data.response)
|
||||
}
|
||||
|
||||
console.log(
|
||||
'%c[nos2x:%c' +
|
||||
message.data.id +
|
||||
'%c]%c result: %c' +
|
||||
JSON.stringify(
|
||||
message?.data?.response || message?.data?.response?.error?.message || {}
|
||||
),
|
||||
'background-color:#f1b912;font-weight:bold;color:white',
|
||||
'background-color:#f1b912;font-weight:bold;color:#a92727',
|
||||
'background-color:#f1b912;color:white;font-weight:bold',
|
||||
'color:auto',
|
||||
'font-weight:bold;color:#08589d'
|
||||
)
|
||||
|
||||
delete window.nostr._requests[message.data.id]
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user