Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export const trackPosition = (element, callbacks) => {
const flow = detectFlow(element);
if (!hasInitialised) {
init();
}
for (let key in callbacks) {
if (callbacks.hasOwnProperty(key)) {
flow[key] = callbacks[key];
}
}
flow.onScreenTrackId = elementsToCheck.push(flow);
};
childWillAppear(node, onComplete) {
if (this.props.onMount) {
this.props.onMount(node);
}
if (this.props.enterOnMount) {
if (this.props.mountValues) {
const nodeFlow = detectFlow(node);
nodeFlow.set({
values: this.props.mountValues
});
}
this.childWillEnter(node, onComplete);
} else {
onComplete();
}
}
startAction(node, action, onComplete) {
const nodeFlow = detectFlow(node);
const connectedAction = nodeFlow.connect(action);
connectedAction.onComplete = onComplete;
connectedAction.start();
}
componentDidMount() {
this.flow = detectFlow(this.getNode());
this.setValues(this.props.values);
if (this.props.actions) {
this.props.actions.forEach((action) => this.startAction(action));
}
}
export const stopTracking = (element) => {
const flow = detectFlow(element);
delete elementsToCheck[flow.onScreenTrackId];
};
componentDidMount() {
this.flow = detectFlow(findDOMNode(this));
this.setValues(this.props.currentState);
}