1.2.2 • Published 3 months ago

luna-performance-monitor v1.2.2

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

Luna Performance Monitor

Realtime counter used for displaying cpu, fps metrics.

Demo

https://luna.liriliri.io/?path=/story/performance-monitor

Install

Add the following script and style to your page.

<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/luna-performance-monitor/luna-performance-monitor.css" />
<script src="//cdn.jsdelivr.net/npm/luna-performance-monitor/luna-performance-monitor.js"></script>

You can also get it on npm.

npm install luna-performance-monitor --save
import 'luna-performance-monitor/luna-performance-monitor.css'
import LunaPerformanceMonitor from 'luna-performance-monitor'

Usage

const memoryMonitor = new PerformanceMonitor(container, {
  title: 'Used JS heap size',
  unit: 'MB',
  color: '#614d82',
  smooth: false,
  data() {
    return (performance.memory.usedJSHeapSize / 1024 / 1024).toFixed(1)
  },
})
memoryMonitor.start()

Configuration

  • color(string): Line color.
  • data(Fn): Data source provider, a number should be returned.
  • height(number): Chart height.
  • max(number): Maximum value.
  • smooth(boolean): Smooth lines or not.
  • title(string): Monitor title.
  • unit(string): Unit of the value.

Api

start(): void

Start monitoring.

stop(): void

Stop monitoring.

1.2.0

6 months ago

1.1.0

6 months ago

1.2.2

3 months ago

1.2.1

6 months ago

1.0.0

8 months ago

0.4.2

1 year ago

0.4.1

2 years ago

0.4.0

2 years ago

0.3.0

2 years ago

0.2.1

2 years ago

0.2.0

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago