Last active
September 14, 2017 09:20
-
-
Save am/b7c7c762e9064dc9c7fc93e13eb8c0a9 to your computer and use it in GitHub Desktop.
Load unload iframe - performance / memory
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head></head> | |
<body> | |
<p>Loaded Content</p> | |
<script> | |
(function(){ | |
var i, el = null, | |
x = []; | |
for (i = 0; i < 10000; i++) { | |
el = document.createElement('div'); | |
el.innerHTML = 'node ' + i; | |
document.body.appendChild(el); | |
} | |
x.push(new Array(1000000).join('x')); | |
})() | |
</script> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head></head> | |
<body> | |
<button onclick="loadGame()">Load</button> | |
<button onclick="unloadGame()">Unload</button> | |
<div class="loader"></div> | |
<script> | |
var loadGame, unloadGame; | |
loadGame = function() { | |
var iframe = document.createElement('iframe'); | |
iframe.className = 'loader--iframe'; | |
iframe.src = 'child.html'; | |
document.querySelector('.loader').appendChild(iframe); | |
}; | |
unloadGame = function() { | |
document.querySelector('.loader') | |
.removeChild(document.querySelector('.loader--iframe')); | |
}; | |
</script> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
python -m SimpleHTTPServer 5000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Clone and run with: