Skip to content
Discussion options

You must be logged in to vote

GM.log has different implementations in different script managers and does not always return a Promise.


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");

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@WhiteSevs
Comment options

Answer selected by lisonge
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants