Comments (4)
First off, I think it would be best if electron offered such feature out of the box. Relying/Depending on java in a node application/context is pretty bad and gkm was more of a proof of concept than expected to be used in any production application to be honest.
Now, it is true that it would be relatively simple to modify
var gkm = spawn('java', ['-jar', path.join(__dirname, 'lib/gkm.jar')]);
such that it could receive any path to the java binary.
As a side note, gkm
could be modified to have start/stop
functions which would start/stop the spawned process (or simply drop events). It would make it possible to configure the path to java
before it is spawned (as the process is now spawned as soon as you require gkm
).
So, something like gkm.setJavaPath(path)
could be conceivable or otherwise a config object and a gkm.setConfig({javaPath: path})
method.
from gkm.
Seems like anything that occurs while Electron is focused is already covered. I'm not sure Electron could handle anything outside of the window. I'll make an issue for it over there but my guess is it'll be out of scope.
I could remove gkm
to avoid relying on Java but it's doing a lot to make the in-game overlay I'm building feel more reactive.
Something like this?
https://gist.github.com/sklink/e75a5ac546fefbe0796ac2009f0b0695
I don't know much about using and managing child processes. .kill('SIGINT')
was the first thing to pop up when I searched.
from gkm.
I agree with you that it is likely this is out of Electron's scope. NW.js however did implement something (see nwjs/nw.js#1735).
As for your gist, yes, something like that would work (don't forget to export setJavaPath). Furthermore, I think you'd want to call .kill()
(defaults to SIGTERM
) instead of .kill('SIGINT')
.
from gkm.
@tomzx How do you pack Java with the Electron package so you can use the Local Java path instead of using the Globally installed one?
from gkm.
Related Issues (20)
- What is inside gkm.jar? HOT 1
- Is there a way to get the keyboard cursor location? HOT 1
- Mouse Wheel HOT 2
- angular2 not supporting yet HOT 1
- Allow consuming events
- After reinstall java, GKM not working on my project?
- How to delete listeners? HOT 1
- Publish the latest v0.3.0 to NPM HOT 1
- key.typed event returns [ 'Undefined' ] HOT 1
- Does not work on linux HOT 1
- How to prevent keyboard long pressed? HOT 4
- Gkm with ReactJS not working HOT 3
- Test on MacOS HOT 5
- not working with Electron-packager HOT 5
- How is it possible to get mouse.wheel events? HOT 1
- `key.released` event doesn't always seem to fire when a key is released HOT 1
- JNativeHook.jar does not work with jdk15.0.2 64-bit (workaround available) HOT 2
- EventEmitter2 is not a constructor HOT 1
- Is there any way to prevent the released event from firing? HOT 1
- Support unicode keyboard listener
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gkm.