Skip to content

Commit

Permalink
Merge pull request #85 from romellem/romellem-patch-1
Browse files Browse the repository at this point in the history
Fix errors when embedding on Pastel (usepastel.com)
  • Loading branch information
David Cetinkaya authored Aug 19, 2020
2 parents e0ffc53 + b846ec6 commit 28cac09
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/vanilla/components/animation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ export type Animation = {
}

export function Animation(callback: FrameRequestCallback): Animation {
const run = requestAnimationFrame.bind(window)
const end = cancelAnimationFrame.bind(window)
let animationFrame = 0

function ifAnimating(active: boolean, cb: Callback): Callback {
Expand All @@ -18,11 +16,11 @@ export function Animation(callback: FrameRequestCallback): Animation {
}

function start(): void {
animationFrame = run(callback)
animationFrame = window.requestAnimationFrame(callback)
}

function stop(): void {
end(animationFrame)
window.cancelAnimationFrame(animationFrame)
animationFrame = 0
}

Expand Down

0 comments on commit 28cac09

Please sign in to comment.