مۇنازىرىلەر » Greasy Fork قا ئىنكاس

await is valid without async function now, but greasyfork shows error when I update my script.

§
يوللانغان ۋاقتى: 2022-07-12

How long would that take to be fixed ?

§
يوللانغان ۋاقتى: 2022-07-14

Can you provide example code?

§
يوللانغان ۋاقتى: 2022-07-15

Can you provide example code?

The error shown when I try to update one of my script.

the below code in the link is the whole lines of my script that I'm trying to update.

the script that I'm trying to post on greasyfork

§
يوللانغان ۋاقتى: 2022-07-15

Greasy Fork uses mini_racer, which depends on libv8-node, to parse scripts. We're using the latest of both, so not much can be done until they release new versions.

§
يوللانغان ۋاقتى: 2022-07-16

Thanks for letting me know Jason ! :)

§
يوللانغان ۋاقتى: 2023-08-17

Is there any follow-up on this issue? I have the same problem.
Modern browsers have supported top-level await for some time now (almost two years). The bug does not occur on TamperMonkey. But libv8-node doesn't seem to follow this feature efficiently.

§
يوللانغان ۋاقتى: 2023-08-17
تەھرىرلەنگەن ۋاقتى: 2023-08-17

Is there any follow-up on this issue? I have the same problem.
Modern browsers have supported top-level await for some time now (almost two years). The bug does not occur on TamperMonkey. But libv8-node doesn't seem to follow this feature efficiently.

why not just

(async ()=>{

// your code here

})();
§
يوللانغان ۋاقتى: 2023-08-18

libv8-node has been updated since my last post, so I've deployed an upgrade just now. Not sure if that fixes anyone's issue as no sample code has been provided (the link for sample code above is dead now).

§
يوللانغان ۋاقتى: 2023-08-18

libv8-node has been updated since my last post, so I've deployed an upgrade just now. Not sure if that fixes anyone's issue as no sample code has been provided (the link for sample code above is dead now).

I've tried removing top-level IIFE from my scripts.
But unfortunately, libv8-node still doesn't seem to support top-level await, and still get "Code contains errors: Uncaught SyntaxError: await is only valid in async functions and the top level bodies of modules at undefined:20:22".
Thanks for the reply, I'll keep an eye on libv8-node :)
https://greasyfork.org/en/scripts/26731-twitter-image-new-tab-redirect-original?locale_override=1

§
يوللانغان ۋاقتى: 2023-08-18

Is it maybe because Tampermonkey is running the script as a module?

§
يوللانغان ۋاقتى: 2023-08-18

Is it maybe because Tampermonkey is running the script as a module?

I think so. top-level await has been turned on by default as an experimental feature of Tampermonkey for a while now.

جاۋاب قايتۇرۇش

جاۋاب قايتۇرۇش ئۈچۈن كىرىش.