Skip to content

Commit

Permalink
Merge pull request #873 from florianchevallier/patch-1
Browse files Browse the repository at this point in the history
Added a classname for the appInsights HOC's div
  • Loading branch information
hectorhdzg authored Jun 10, 2019
2 parents 96450e5 + 04da5e7 commit 664ed28
Showing 1 changed file with 7 additions and 1 deletion.
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

0 comments on commit 664ed28

Please sign in to comment.