dot.dot.dot.exampol
This commit is contained in:
commit
a0bc2d79de
406 changed files with 34577 additions and 0 deletions
31
node_modules/bunker/example/top/run.js
generated
vendored
Normal file
31
node_modules/bunker/example/top/run.js
generated
vendored
Normal file
|
@ -0,0 +1,31 @@
|
|||
var bunker = require('bunker');
|
||||
var fs = require('fs');
|
||||
var src = fs.readFileSync(__dirname + '/src.js', 'utf8');
|
||||
|
||||
var counts = {};
|
||||
|
||||
var b = bunker(src);
|
||||
b.on('node', function (node) {
|
||||
if (!counts[node.id]) {
|
||||
counts[node.id] = { times : 0, node : node };
|
||||
}
|
||||
counts[node.id].times ++;
|
||||
});
|
||||
|
||||
b.run({
|
||||
setInterval : setInterval,
|
||||
clearInterval : clearInterval,
|
||||
end : function () {
|
||||
Object.keys(counts)
|
||||
.sort(function (a, b) {
|
||||
return counts[b].times - counts[a].times
|
||||
})
|
||||
.forEach(function (key) {
|
||||
var count = counts[key];
|
||||
console.log(
|
||||
count.times + ' : ' + count.node.source()
|
||||
);
|
||||
})
|
||||
;
|
||||
}
|
||||
});
|
18
node_modules/bunker/example/top/src.js
generated
vendored
Normal file
18
node_modules/bunker/example/top/src.js
generated
vendored
Normal file
|
@ -0,0 +1,18 @@
|
|||
function boop () {
|
||||
for (var i = 0; i < 30; i++) {
|
||||
nop();
|
||||
}
|
||||
}
|
||||
|
||||
function nop () {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
var times = 0;
|
||||
var iv = setInterval(function () {
|
||||
if (++times === 10) {
|
||||
clearInterval(iv);
|
||||
end();
|
||||
}
|
||||
else boop()
|
||||
}, 100);
|
Loading…
Add table
Add a link
Reference in a new issue