You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I am trying to execute an asynchronous function in popup.tsx as shown by this simple example:
asyncfunctiontest(){returnnewPromise((resolve)=>resolve(["hello","world"]),);}<buttononClick={()=>{chrome.tabs.query({active: true,currentWindow: true},(tabs)=>{const{ id }=tabs[0];chrome.scripting.executeScript({target: {tabId: id},world: "MAIN",func: testargs: [],});});}}>Asyncfunctioncall</button>
Manifest permissions includes : activeTab, scripting.
The issue appears to be with using async with plasmo. It works fine when the function is not async, which implies that chrome.scripting.executeScript can handle asynchronous calls, but not when you use it with plasmo.
If anyone could provide some assistance with this issue, it would be greatly appreciated.
Version
Latest
What OS are you seeing the problem on?
MacOSX
What browsers are you seeing the problem on?
Chrome
Relevant log output
Exception :
Uncaught ReferenceError: _func is not defined
at func (<anonymous>:2:37)
at <anonymous>:3:35
### (OPTIONAL) Contribution
- [ ] I would like to fix this BUG via a PR
### Code of Conduct
- [X] I agree to follow this project's Code of Conduct
- [X] I checked the [current issues](https://github.com/PlasmoHQ/plasmo/issues?q=is%3Aopen+is%3Aissue+label%3Abug) for duplicate problems.
The text was updated successfully, but these errors were encountered:
What happened?
Hi, I am trying to execute an asynchronous function in
popup.tsx
as shown by this simple example:Manifest permissions includes :
activeTab
,scripting
.The issue appears to be with using
async
withplasmo
. It works fine when the function is notasync
, which implies thatchrome.scripting.executeScript
can handle asynchronous calls, but not when you use it withplasmo
.If anyone could provide some assistance with this issue, it would be greatly appreciated.
Version
Latest
What OS are you seeing the problem on?
MacOSX
What browsers are you seeing the problem on?
Chrome
Relevant log output
Generated coded :
The text was updated successfully, but these errors were encountered: