I'm currently trying to update my chrome extension with es6 classes. It works fine in the context of the background scripts. But I can't access this classes from within the ui page (i.e. the extension's popup) using chrome.extension.getBackgroundPage().
background.js
function Foo() { ... }
class Bar { ... }
popup.js
var bg = chrome.extension.getBackgroundPage();
new bg.Foo() // works
new bg.Bar() // Bar is undefined
I found this simple workaround:
background.js
class Bar {}
var exports = { Bar : Bar };
popup.js
var bg = chrome.extension.getBackgroundPage();
new bg.exports.Bar() // works
Any ideas why it's not possible to get direct access to classes via the 'bg' object?