@renderium/logger

0.4.0 • Public • Published

Renderium Logger

NPM version js-standard-style

Table of Contents

Features

  • Designed with performance in mind
  • Simple - 70 LOC
  • Lightweight - 6 Kb

Install

npm install --save @renderium/logger

or download dev or prod version

Usage

var logger = new Logger({
  target: document.body
})

var start = Date.now()
requestAnimationFrame(function loop (t) {
  var dt = t - start
  var memory = performance.memory.usedJSHeapSize / 1048576
  start = t

  logger.log('dt', dt.toFixed(2))
  logger.log('fps', Math.round(1000 / dt))
  logger.log('memory', memory.toFixed(2))

  requestAnimationFrame(loop)
})

navigator.getBattery().then(battery => {
  logger.log('battery', `${battery.level * 100}%`)

  battery.addEventListener('levelchange', () => {
    logger.log('battery', `${battery.level * 100}%`)
  })
})

Development

Command Description
npm run build Wrap source code in UMD by rollup
npm run min Minify code by UglifyJS

Readme

Keywords

Package Sidebar

Install

npm i @renderium/logger

Weekly Downloads

0

Version

0.4.0

License

MIT

Unpacked Size

53.8 kB

Total Files

11

Last publish

Collaborators

  • broadsw0rd