Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
raf(callback) {
if (this.requestFrame) raf.cancel(this.requestFrame);
this.requestFrame = raf(() => {
this.requestFrame = undefined;
callback();
});
}
public notifySubscribers(evt) {
if (!this.framePending) {
const {currentTarget} = evt;
this.rafHandle = raf(() => {
this.framePending = false;
const {top, bottom} = this.node.getBoundingClientRect();
this.subscribers.forEach(handler =>
handler({
distanceFromTop: top,
distanceFromBottom: bottom,
eventSource: currentTarget === window ? document.body : this.node
})
);
});
this.framePending = true;
}
}
function animate() {
raf(animate)
tween.update()
}
handleTouchMove(e) {
e.preventDefault();
if (!this._updatingPosition) {
const { clientX: x, clientY: y } = e.touches[0];
raf(() => this._updatePosition({x, y}));
}
this._updatingPosition = true;
this._clearHoldTimers();
}
prepareTween() {
this.tweenHandle = raf((timestamp) => {
this.tweenValue(timestamp, true);
});
}
runLoop() {
this.rafId = raf(this.loopBound);
}
function slideLeftOut(action, component, done) {
if (action === 'push') {
raf(() => {
component.setState({
style: {
transform: 'translate3d(0, 0, 0)',
WebkitTransform: 'translate3d(0, 0, 0)',
opacity: 1,
zIndex: 1,
},
});
raf(() => {
component.setState({
style: {
transform: 'translate3d(-20%, 0, 0)',
WebkitTransform: 'translate3d(-20%, 0, 0)',
transition: 'all .4s cubic-bezier(.2, .7, .1, 1)',
transitionProperty: 'transform, opacity',
WebkitTransition: 'all .4s cubic-bezier(.2, .7, .1, 1)',
function animate () {
raf(animate)
tween.update()
}
function animate() {
raf(animate)
if (tween) tween.update()
}
animate()
var frameFunc = function frameFunc() {
var timestamp = Date.now();
var time = timestamp - startTime;
var nextScrollTop = easeInOutCubic(time, scrollTop, targetScrollTop, 450);
if (container === window) {
window.scrollTo(window.pageXOffset, nextScrollTop);
} else {
container.scrollTop = nextScrollTop;
}
if (time < 450) {
raf(frameFunc);
} else {
callback();
}
};