var makeGroup = function(name,fun) {
var newgroup = new group();
newgroup.name=name;
newgroup.status='ok';
newgroup.stack=[];
var oldRoot = root;
root = newgroup;
try {
fun();
}
catch(e) {
newgroup.status=e;
}
root = oldRoot;
root.stack.push(newgroup);
}
var timeoutID;
$('#btn').click(function () {
test();
});
function test() {
clearTimeout(timeoutID);
timeoutID = setTimeout(function () {
console.log('1');
}, 3000);
}