Skip to content

Commit

Permalink
Added className in withAITracking function
Browse files Browse the repository at this point in the history
  • Loading branch information
florianchevallier committed Jun 7, 2019
1 parent cbf3f29 commit 19ad578
Showing 1 changed file with 7 additions and 2 deletions.
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,7 +82,7 @@ export default function withAITracking<P>(reactPlugin: ReactPlugin, Component: R
onMouseDown={this.trackActivity}
onTouchStart={this.trackActivity}
onTouchMove={this.trackActivity}
className="appinsights-hoc"
className={className}
>
<Component {...this.props} />
</div>
Expand Down

0 comments on commit 19ad578

Please sign in to comment.