-
例如: // 这样就有问题
GM.log(123).then(()=>{
console.log("log end");
}) |
Beta Was this translation helpful? Give feedback.
Answered by
lisonge
Jun 25, 2025
Replies: 1 comment 1 reply
-
https://github.com/violentmonkey/violentmonkey // ==UserScript==
// @name test
// @namespace https://github.com/lisonge
// @version 1.0.0
// @match https://*/*
// @grant GM.log
// @noframes
// ==/UserScript==
console.log(`GM.log('123')`, GM.log('123')); Solution: Promise.resolve(GM.log('123')).then(()=>{
console.log("log end");
})
// or
await GM.log('123')
console.log("log end"); |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
lisonge
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
GM.log
has different implementations in different script managers and does not always return aPromise
.https://github.com/violentmonkey/violentmonkey
Solution: