Closed wickedst closed 2 years ago
Right now I don't think you can. Except if you can access the default session from the remote
object in your JS (but this has been deprecated so I wouldn't recommend it).
If I understand the doc correctly, one would need to add a func LoadExtension(path string) error
method in the Session struct that would make sure to call loadExtension in JS.
Then all you'd need to do is make sure to put your extension in your resources (so that it gets bundled with your binary), and call the LoadExtension
function with the path to the extension in your resources.
If you feel like submitting a PR, go for it. I can provide more information.
Cheers
I've had a go at it here: #317
I'm sure there's more to it than this, hopefully you won't mind pointing me in the right direction! I'm the front-end part of the team so my Go skills are beginnner at best :)
No worries, I'll try to guide you the best I can.
Your PR is a good first step for the GO part, I'll make a review shortly. However you also need to make a PR for astilectron for the JS part :
1) Add a sessionCmdLoadExtension
and sessionEventLoadedExtension
here
2) Clone this switch case and adapt it to call loadExtension
(bare in mind that in this case elements[json.targetID]
is the session)
3) Make sure both constants and switch cases are ordered alphabetically
Good luck
It looks like the issue has been completed. Consider to closed?
What's the best way to load a Chrome extension in the Electron window?
I've found the guide for using extensions in the Electron docs
How can I adapt this in go-astilectron... maybe via Window.ExecuteJavaScript?