Skip to content

Instantly share code, notes, and snippets.

@cpsubrian
Last active August 29, 2015 14:03
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 cpsubrian/ab0726e6ad5f6f8fc06f to your computer and use it in GitHub Desktop.
Save cpsubrian/ab0726e6ad5f6f8fc06f to your computer and use it in GitHub Desktop.
Replicate Atom-Shell Stall/Idle Problem
var app = require('app')
, ipc = require('ipc')
, BrowserWindow = require('browser-window')
, mainWindow;
app.on('window-all-closed', function() {
if (process.platform != 'darwin')
app.quit();
});
app.on('ready', function() {
mainWindow = new BrowserWindow({
'width': 500,
'height': 500,
'use-content-size': true,
'resizeable': false,
'always-on-top': true
});
console.time('done');
function done() {
setTimeout(function () {
console.timeEnd('done');
}, 50);
}
mainWindow.loadUrl('file://' + __dirname + '/index.html');
mainWindow.webContents.once('did-finish-load', function () {
mainWindow.once('iframe-loaded', function () {
done();
});
mainWindow.webContents.send('load', 'file://' + __dirname + '/iframe.html');
});
mainWindow.on('closed', function () {
mainWindow = null;
});
});
// Uncomment the following line to speed up the app.
//setInterval(function(){}, 5);
<h1>Hello</h1>
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
html, body, iframe {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
position: relative;
border: none;
}
iframe {
background: #eee;
}
</style>
</head>
<body>
<iframe id="frame" scrolling="no" seamless="seamless"></iframe>
<script>
var ipc = require('ipc')
, browser = require('remote').getCurrentWindow()
, frame = document.getElementById('frame');
ipc.on('load', function (url) {
frame.onload = function () {
browser.emit('iframe-loaded');
};
frame.src = url;
});
</script>
</body>
</html>
run: run-osx
run-osx:
./Atom.app/Contents/MacOS/Atom ./
PHONY: run
PHONY: run-osx
{
"name": "ab0726e6ad5f6f8fc06f",
"version": "0.0.0",
"main": "app.js"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment