Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a classname for the appInsights HOC's div #873

Merged
merged 5 commits into from
Jun 10, 2019
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,18 @@ import ReactPlugin from './ReactPlugin';
* @param reactPlugin ReactPlugin instance
* @param Component the React component to be instrumented
* @param componentName (optional) component name
* @param className (optional) className of the HOC div
*/
export default function withAITracking<P>(reactPlugin: ReactPlugin, Component: React.ComponentType<P>, componentName?: string): React.ComponentClass<P> {
export default function withAITracking<P>(reactPlugin: ReactPlugin, Component: React.ComponentType<P>, componentName?: string, className?: string): React.ComponentClass<P> {

if (componentName === undefined || componentName === null || typeof componentName !== 'string') {
componentName = Component.prototype.constructor.name;
}

if (className === undefined || className === null || typeof className !== 'string') {
className = '';
}

return class extends React.Component<P> {
private _mountTimestamp: number = 0;
private _firstActiveTimestamp: number = 0;
Expand Down Expand Up @@ -77,6 +82,7 @@ export default function withAITracking<P>(reactPlugin: ReactPlugin, Component: R
onMouseDown={this.trackActivity}
onTouchStart={this.trackActivity}
onTouchMove={this.trackActivity}
className={className}
>
<Component {...this.props} />
</div>
Expand Down