mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-11-11 04:48:44 +03:00
window.measure takes an optional callback
This commit is contained in:
parent
8e77c05c06
commit
6319274284
12
index.html
12
index.html
@ -4,9 +4,9 @@
|
||||
<script src='src/stdlib/require.js'></script>
|
||||
|
||||
<script>
|
||||
window.measure = function(name) {
|
||||
window.measure = function(name, fn) {
|
||||
var start = new Date().getTime();
|
||||
return {stop: function() {
|
||||
obj = {stop: function() {
|
||||
var end = new Date().getTime();
|
||||
var total = (end - start) / 1000;
|
||||
while(name.length < 40) {
|
||||
@ -14,6 +14,14 @@
|
||||
}
|
||||
console.log(name + (end - start) / 1000);
|
||||
}}
|
||||
|
||||
if (fn) {
|
||||
fn()
|
||||
obj.stop()
|
||||
}
|
||||
else {
|
||||
return obj
|
||||
}
|
||||
}
|
||||
|
||||
window.onload = function() {
|
||||
|
Loading…
Reference in New Issue
Block a user