@awsui/components-react
Version:
AWS UI is a collection of [React](https://reactjs.org/) components that help create intuitive, responsive, and accessible user experiences for web applications. It is developed by Amazon Web Services (AWS). This work is available under the terms of the [A
13 lines (12 loc) • 490 B
JavaScript
import { useEffect } from 'react';
import { Metrics } from '../../metrics';
export function useTelemetry(componentName) {
useEffect(function () {
if (typeof window !== 'undefined') {
Metrics.sendMetricOnce('awsui-viewport-width', window.innerWidth || 0);
Metrics.sendMetricOnce('awsui-viewport-height', window.innerHeight || 0);
}
Metrics.logComponentLoaded();
Metrics.logComponentUsed(componentName.toLowerCase());
}, []);
}