Skip to content

Instantly share code, notes, and snippets.

@sapandiwakar
Last active September 16, 2015 22:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sapandiwakar/0b6ad79dc5ae5cbcf9a7 to your computer and use it in GitHub Desktop.
Save sapandiwakar/0b6ad79dc5ae5cbcf9a7 to your computer and use it in GitHub Desktop.
Cannot use `setImmediate` in electron child process
process.on('message', function (message) {
setImmediate(function() {
console.log(message.message);
});
});
<html>
<head>
<title>Test</title>
</head>
<body>
<script src="index.js"></script>
</body>
</html>
var ps = require('child_process'),
path = require('path')
this.process = ps.fork(path.join(__dirname, 'child.js'));
this.process.send({
message: 'test'
});
var app = require('app'),
BrowserWindow = require('browser-window'),
path = require('path'),
_this = this;
app.on('ready', function () {
_this.mainWindow = new BrowserWindow({
width: 800,
height: 600,
show: true
});
_this.mainWindow.loadUrl(path.join('file://', __dirname, 'index.html'));
_this.mainWindow.on('closed', function () {
_this.mainWindow = null;
});
});
<html>
<head>
<title>Test</title>
</head>
<body>
<script src="index.js"></script>
</body>
</html>
Submit new issue
@etiktin
Copy link

etiktin commented Sep 16, 2015

The content of package.json is incorrect (it seems like a copy of index.html).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment