log command results.
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "nos2x",
|
"name": "nos2x",
|
||||||
"description": "Nostr Signer Extension",
|
"description": "Nostr Signer Extension",
|
||||||
"version": "2.0.3",
|
"version": "2.1.0",
|
||||||
"homepage_url": "https://github.com/fiatjaf/nos2x",
|
"homepage_url": "https://github.com/fiatjaf/nos2x",
|
||||||
"manifest_version": 3,
|
"manifest_version": 3,
|
||||||
"icons": {
|
"icons": {
|
||||||
|
|||||||
@@ -27,8 +27,23 @@ window.nostr = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
_call(type, params) {
|
_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) => {
|
return new Promise((resolve, reject) => {
|
||||||
let id = Math.random().toString().slice(4)
|
|
||||||
this._requests[id] = {resolve, reject}
|
this._requests[id] = {resolve, reject}
|
||||||
window.postMessage(
|
window.postMessage(
|
||||||
{
|
{
|
||||||
@@ -61,6 +76,20 @@ window.addEventListener('message', message => {
|
|||||||
window.nostr._requests[message.data.id].resolve(message.data.response)
|
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]
|
delete window.nostr._requests[message.data.id]
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user