1.0.1 • Published 3 years ago

trap-monkey v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

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

TypeDefault ValueDescription
mode'once' | 'debug''report'If log is set to 'once', the performance will be print in 10s after component is initialized; in other hand, in 'debug' mode, performance will be print at every time method is called.
reportDelaynumber1e4After reportDelay ms, performance will be print. Only works in 'once' mode.
namestring''Custom name of target class.