Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not a Bug: using in Electron #27

Open
JMS-1 opened this issue Mar 24, 2018 · 1 comment
Open

Not a Bug: using in Electron #27

JMS-1 opened this issue Mar 24, 2018 · 1 comment

Comments

@JMS-1
Copy link

JMS-1 commented Mar 24, 2018

Just in brief a report on what I did to make it work with electron 1.8.4 - actually there may be better approaches since I'm not that deep into the matter. At least as a Proof-Of-Concept it works, configuration might be a big issue. But here we go (in brief!):

  • electron does not support chrome.extension.sendMessage and chrome.extension.onMessage which are both deprecated by the way. I had to use chrome.runtime instead of chrome.extension as MDN suggests.
  • is seems as if electron does not support background pages. Using Process Monitor on Windows 10 I could see that background.js is loaded but it seems to not get executed. So here comes the work-around in hope for better times.
  • I removed background.js from the manifest.json (although since it's not working this may not be necessary) and integrated it into script.js. Actually there is some fine tuning and I will give the details if someone needs it. More or less I encapsulated the background.js in a function which is called when the extension starts and replaced chrome.extension(runtime).sendMessage with a delayed (setTimeout(,0)) chrome.runtime.onMessage.emit. This is not really clean but seems to work as expected.
  • Two incompatibility corrections for the Chrome version (59) used in electron 1.8.4 (no InputEvent class) and a missing chrome.tabs (could be since my app is running in kiosk mode could be a electron issue but doesn't matter for me) and I got the keyboard running.

If there is any better way I would really like to hear about it!

Jochen

PS: Forked the changes at https://github.com/JMS-1/chrome-virtual-keyboard. Sorry for the script.js mess due to the the reformatting (space/tabs): it's NOT that big of a change!

@subvertallchris
Copy link

This is very useful, thank you for sharing it! I can't find any documentation about those two deprecations. Could you link to something?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants