Accurate and predictable testing of requestAnimationFrame and cancelAnimationFrame
✅No API breaking changes.
The paths to the bundled files have changed. If you are consuming the package through npm
, yarn
or similar then you will be all good
[email protected]
src
and dist
to npm
rather than the whole packageStub
typeprettier
#51babel
and other dev deps #51rollup
to generate bundles, rather than @babel/cli
replaceRaf
0.3.x
api.Deprecated api
function replaceRaf(...rest: Array<Object>): void
replaceRaf();
replaceRaf(global, window, anotherRoot);
Stable api
type ReplaceRafOptions = {
frameDuration?: number,
startTime?: number
};
function replaceRaf(roots?: Object[] = [], { frameDuration = defaultFrameDuration, startTime = now() }: ReplaceRafOptions = {})
replaceRaf();
replaceRaf([global, window, anotherRoot]);
replaceRaf([global, window, anotherRoot], { frameDuration = 1000 / 60, startTime = performance.now() })
ReplaceRafOptions
.// old
type ReplaceRafOptions = {
duration?: number,
startTime?: number
};
replaceRaf([window], { duration = 1000 / 60, startTime = performance.now() });
// new
type ReplaceRafOptions = {
// name has changed
frameDuration?: number,
startTime?: number
};
replaceRaf([window], { frameDuration = 1000 / 60, startTime = performance.now() });
Changing from duration
to frameDuration
brings the function names in line with createStub()
and also the docs. The docs actually always had the argument named as frameDuration
whereas the code had duration
.
(none)
(none)
#33 - Removing unneeded package engines
requirement. Previously there was a cleanup in 1.0.2
to tighten up a lot of things which included adding an engines
requirement. This was an attempt to reduce the chance of consumers getting errors from older node versions that I have not tested on. In the future I may see how far back you can go with raf-stub
but my suspicion is that it can go back so far that any engines
requirement would not be that meaningful. I can look into this further in the future if the need arises.
(none)
This is a minor addition to the previous release that adds also publishes .flow
files into the lib
folder. This allows for rich flow integration in your project with correct auto complete and type checking for arguments.
More details on the process around this: https://medium.com/@ryyppy/shipping-flowtype-definitions-in-npm-packages-c987917efb65#.f8uaswrz8
(none)
replaceRaf(roots)
has become replaceRaf([roots], options)
. This allows you to use the replaceRaf
syntax to set the startTime
and frameDuration
for a stub
.replaceRaf(roots)
will continue to work but has been depreciated and will be removed in a future major release.requestAnimationFrame
callbacks. This has added relevant options to createStub
, step
, flush
and replaceRaf
.enhance
has been renamed to replaceRaf
. I think this a clearer name as it better describes what the function is doing. Naming is hard.