Skip to content

2.0.0

Choose a tag to compare

@alexreardon alexreardon released this 09 Jan 22:24
· 9 commits to master since this release

API changes

1. Finally removing the depreciated the 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() })

2. changing argument name for 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.

Other changes

(none)