uistats-typescript
v0.0.2
Published
A tiny ui component to display app stats.
Downloads
6
Readme
UIStats (TypeScript and Javascript)
ikaroskappler/uistats-typescript
This is a tiny UI module for displaying simple stats data.
The whole production library is only 3.4kB.
Interactive demo in a polygon App
Install
$ npm install uistats-typescript
Browserify
var UIStats = require('uistats-typescript');
Browser
<script src="dist/uistats.min.js"></script>
Use
...
const myStats = {
area : 0.0,
status : 'Loading ...',
hasErrors : false,
touchCount : 1
};
var uiStats = new UIStats( myStats );
myStats = uiStats.proxy;
uiStats.add( 'area' ).precision( 3 ).suffix(' spx');
uiStats.add( 'status' );
uiStats.add( 'hasErrors' );
uiStats.add( 'touchCount' );
// ... do your stuff ...
// When the stats members update, the change will immediately become
// visible in the UI component
myStats.area = calculateArea(...);
Compatibility
Note that the library uses Proxy which is not supported by IE.
Consider using a polyfill in the case you need IE support.