uistats-typescript

0.0.2 • Public • Published

License 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.

Screenshot

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.

Readme

Keywords

Package Sidebar

Install

npm i uistats-typescript

Weekly Downloads

5

Version

0.0.2

License

MIT

Unpacked Size

77.1 kB

Total Files

21

Last publish

Collaborators

  • ikaroskappler