Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
componentDidMount() {
const self = this;
const reactI13n = self._getReactI13n();
if (!reactI13n) {
return;
}
// bind the click event for i13n component if it's enabled
if (self.props.bindClickEvent) {
self.clickEventListener = listen(ReactDOM.findDOMNode(self), 'click', clickHandler.bind(self));
}
const domNode = ReactDOM.findDOMNode(self);
self._i13nNode.setDOMNode(domNode);
// enable viewport checking if enabled
if (reactI13n.isViewportEnabled()) {
self._viewportDetector = new ViewportDetector(domNode, self._getViewportOptions(), () => {
self._handleEnterViewport();
});
if (pageInitViewportDetected) {
self._viewportDetector.init();
} else {
self._triggerPageInitViewportDetection();
}
}
i13nNode.setDOMNode(element);
const subThis = {
props: {
href: element.href,
follow: true
},
getI13nNode: function getI13nNodeForScannedNode() {
return i13nNode;
}
};
subThis._shouldFollowLink = self._shouldFollowLink.bind(subThis);
subThis.executeI13nEvent = self.executeI13nEvent.bind(self);
self._subI13nComponents.push({
componentClickListener: listen(element, 'click', clickHandler.bind(subThis)),
debugDashboard: IS_DEBUG_MODE ? new DebugDashboard(i13nNode) : null,
domElement: element,
i13nNode
});
self._getReactI13n().execute('created', { i13nNode });
});
},