Jack D on Nostr: I don't think the issue has anything to do with setting a promise as a variable. The ...
I don't think the issue has anything to do with setting a promise as a variable. The async method is the promise. You're setting an executed promise as the variable. In the constructor, set `this.pubkeys = this.getpubkeys` then you can in the call function `await this.pubkeys`
The problem is that constructors are synchronous and cannot be made promise-like. So it's just calling a promise as if it were not.
Published at
2024-10-10 03:56:35Event JSON
{
"id": "23f76d95dd21d9283c93363281bd42114b72ff2cdb15e2b937d016d49d31f73f",
"pubkey": "21580a98aaf64f7d66705abe7bf7a7acf4ee440fcf6b59d0b76e16217824d895",
"created_at": 1728532595,
"kind": 1,
"tags": [
[
"e",
"6a1ecf402012358931cab465bc20fa7b3c4403ea2aabbd8fa9927d24d22906f7",
"",
"root"
],
[
"p",
"0461fcbecc4c3374439932d6b8f11269ccdb7cc973ad7a50ae362db135a474dd"
],
[
"r",
"this.getpubkeys"
],
[
"r",
"this.pubkeys"
]
],
"content": "I don't think the issue has anything to do with setting a promise as a variable. The async method is the promise. You're setting an executed promise as the variable. In the constructor, set `this.pubkeys = this.getpubkeys` then you can in the call function `await this.pubkeys`\n\nThe problem is that constructors are synchronous and cannot be made promise-like. So it's just calling a promise as if it were not. ",
"sig": "b250ed084cf97a0814a8e0bd424e0d6f6ad05a8598d17453d59630e5ba0ca60a1c2b89ad88523468022825c7aaada04fdfe5a43036950966dd96c69493d17528"
}