Skip to content

Instantly share code, notes, and snippets.

@am
Last active September 14, 2017 09:20
Show Gist options
  • Save am/b7c7c762e9064dc9c7fc93e13eb8c0a9 to your computer and use it in GitHub Desktop.
Save am/b7c7c762e9064dc9c7fc93e13eb8c0a9 to your computer and use it in GitHub Desktop.

Revisions

  1. am revised this gist Sep 14, 2017. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions run.sh
    Original file line number Diff line number Diff line change
    @@ -1 +1,3 @@
    #!/bin/bash

    python -m SimpleHTTPServer 5000
  2. am created this gist Sep 14, 2017.
    19 changes: 19 additions & 0 deletions child.html
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    <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>
    22 changes: 22 additions & 0 deletions parent.html
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,22 @@
    <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>
    1 change: 1 addition & 0 deletions run.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    python -m SimpleHTTPServer 5000