lafikl/perfBar — pull request #12 by JoshuaJones (2014-08-27 06:32:14+00:00)
Title: Add testsComplete callback to config

Adds a callback after metrics have run to be called if present in the config object passed on initialization.

Found myself wanting more of an "alert" when a perf test would fail.

Would allow developers some flexibility in how to address/handle issues. For example:

```javascript
perfBar.init({
budget: {
globalJS: {
max: 1
},
numOfEl: {
max: 50
}
},
testsComplete: function (results) {
var color = '#FF3535';

console.group('perfBar Tests');
for(var prop in results) {
if (results[prop].isBad) {
console.log ('%c %c ' + prop + ' %c %c ' + results[prop].hint + ' ', "color: "+color+";background:"+color, "color:"+color+";background:#333333", "background:#333333", "color:#777777;background:#e5e5e5");
perfBar.el.classList.toggle('perfBar-is-active');
}
}
console.groupEnd();
}
});
```

Would produce the following and open the perfBar metrics container:

![alt text](http://f.cl.ly/items/0c2c0e361A423z3q0633/Screen%20Shot%202014-08-26%20at%2011.26.49%20PM.png "PerfBar Test Issues")

Thoughts?