So I've discovered the hard way that executeInBackground only works with arrow functions.
Consider this user script:
executeInBackground(() => console.log('hello'));
This correctly outputs "hello" to the extension console.
In contrast, these other snippets fail with very unhelpful errors:
function func(){
console.log('hello');
}
executeInBackground(func);
// Uncaught (in promise) Error: eval(...) is undefined
executeInBackground((function(){
console.log('hello');
}));
// Uncaught (in promise) Error: function statement requires a name
So I've discovered the hard way that
executeInBackground
only works with arrow functions.Consider this user script:
This correctly outputs "hello" to the extension console.
In contrast, these other snippets fail with very unhelpful errors: