@btilford/ts-base-browser
v1.1.2
Published
ts-base browser package
Downloads
15
Maintainers
Readme
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.