Measures performance of ES6 class via decorator
import {trapMonkey} from "trap-monkey";
@trapMonkey({ mode: 'once', name: 'my-buggy' })
class MyBuggyComponent {
slowMethod() {
const now = Date.now();
while(Date.now() - now <= 2) {
// do nothing
}
}
}
Type | Default Value | Description | |
---|---|---|---|
mode |
`'once' | 'debug'` | 'report' |
reportDelay |
number | 1e4 | After reportDelay ms, performance will be print. Only works in 'once' mode. |
name |
string | '' |
Custom name of target class. |