@btilford/ts-base-browser
TypeScript icon, indicating that this package has built-in type declarations

1.1.2 • Public • Published

ts-base-browser

Installation

npm install --save @btilford/ts-base-browser

Features

Load Env data from the DOM

<html>
<head>
<meta name="cfg:appOptions:x" content="abc">
<meta name="cfg:LEVEL" content="debug">
</head>
<body>
<script>
import {Env} from '@btilford/ts-base';
import {loadEnvWithMetaTags} from '@btilford/ts-base-browser';
const env = Env.load([
  loadEnvWithMetaTags('cfg:', document);
]);
console.assert(env.getConfig('appOptions:').x === 'abc');
console.assert(env.getProp('LEVEL') === 'debug');
</script>
</body>
</html>

Timer for Performance API

There is a Timer implementation that records marks and measures to window.performance. It can be used with the @Timed() and @TimedAsync() decorators.

import {Timed, bootstrap} from '@btilford/ts-base';
import {PerformanceTimerFactory} from '@btilford/ts-base-browser';



bootstrap({
  appName:'my-app',
  apm: {
    features: {
      timer: new PerformanceTimerFactory({})
    } 
  } 
});


class Example {
  @Timed() // Record time for calls to this function.  
  method() {
    console.log('called');
  } 
}

See ts-base for additional information.

Dependencies (1)

Dev Dependencies (61)

Package Sidebar

Install

npm i @btilford/ts-base-browser

Weekly Downloads

0

Version

1.1.2

License

MIT

Unpacked Size

213 kB

Total Files

71

Last publish

Collaborators

  • btilford