/trap-monkey

Measures performance of ES6 class via decorator

Primary LanguageTypeScriptMIT LicenseMIT

trap-monkey

Measures performance of ES6 class via decorator

Usage

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
        }
    }
}

API

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.