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
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:
functionfunc(){console.log('hello');}executeInBackground(func);// Uncaught (in promise) Error: eval(...) is undefinedexecuteInBackground((function(){console.log('hello');}));// Uncaught (in promise) Error: function statement requires a name
The text was updated successfully, but these errors were encountered:
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:
The text was updated successfully, but these errors were encountered: