Vanilla javascript helper to easily bind window resize and scroll events via requestAnimationFrame.