Skip to content

Instantly share code, notes, and snippets.

@rquigley
Created April 21, 2015 18:15
Show Gist options
  • Save rquigley/19a391aed5af40b7c1ed to your computer and use it in GitHub Desktop.
Save rquigley/19a391aed5af40b7c1ed to your computer and use it in GitHub Desktop.

Revisions

  1. Ryan Quigley created this gist Apr 21, 2015.
    20 changes: 20 additions & 0 deletions jsperf_phantom.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    /* global document, require, setTimeout, phantom, console */
    var jsPerfTest = "for-loops-with-caching";
    var page = require("webpage").create();

    page.open("http://jsperf.com/" + jsPerfTest, function() {
    "use strict";

    setTimeout(function() {
    page.evaluate(function() {
    var ev = document.createEvent("MouseEvents");
    ev.initEvent("click", true, true);
    document.querySelector("#run").dispatchEvent(ev);
    });
    setTimeout(function() {
    console.log("Test is complete");
    phantom.exit();
    }, 20000);
    }, 2000);
    });