Skip to content

Instantly share code, notes, and snippets.

@cdata
Created November 6, 2015 21:43
Show Gist options
  • Select an option

  • Save cdata/0e97b6e4fa7d88fcdb49 to your computer and use it in GitHub Desktop.

Select an option

Save cdata/0e97b6e4fa7d88fcdb49 to your computer and use it in GitHub Desktop.
<head>
<base href="http://localhost:8888/components/test-benchmark/demo/">
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
<script>
(function SetupFrame() {
'use strict';
function Test () {
this.startTime = -1;
this.stopTime = -1;
}
Test.now = function () {
if (window.performance && window.performance.now) {
return window.performance.now();
}
return Date.now();
}
Test.prototype = {
start: function () {
this.startTime = Test.now();
},
stop: function () {
this.stopTime = Test.now();
},
report: function () {
window.parent.postMessage({
elapsed: this.stopTime - this.startTime
}, '*');
}
};
window.StartTest = function () {
window.__simple_benchmark_test__ = new Test();
window.__simple_benchmark_test__.start();
};
window.EndTest = function () {
window.__simple_benchmark_test__.stop();
window.__simple_benchmark_test__.report();
};
})();
</script>
</head>
<body>
<link rel="import" href="//polygit.org/paper-button+polymerelements+v1.0.0/components/paper-button/paper-button.html">
<script>
window.addEventListener("WebComponentsReady", function() {
StartTest();
var component = document.createElement("paper-button");
document.body.appendChild(component);
EndTest();
});
</script>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment