Travis build: 1782 [cron]

This commit is contained in:
30secondsofcode
2018-03-06 20:32:31 +00:00
parent e7c5bcf6c6
commit 536373e77b
4 changed files with 48 additions and 13 deletions

View File

@ -0,0 +1,21 @@
const recordAnimationFrames = (callback, autoStart = true) => {
let running = true,
raf;
const stop = () => {
running = false;
cancelAnimationFrame(raf);
};
const start = () => {
running = true;
run();
};
const run = () => {
raf = requestAnimationFrame(() => {
callback();
if (running) run();
});
};
if (autoStart) start();
return { start, stop };
};
module.exports = recordAnimationFrames;

View File

@ -0,0 +1,13 @@
const test = require('tape');
const recordAnimationFrames = require('./recordAnimationFrames.js');
test('Testing recordAnimationFrames', (t) => {
//For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape
t.true(typeof recordAnimationFrames === 'function', 'recordAnimationFrames is a Function');
//t.deepEqual(recordAnimationFrames(args..), 'Expected');
//t.equal(recordAnimationFrames(args..), 'Expected');
//t.false(recordAnimationFrames(args..), 'Expected');
//t.throws(recordAnimationFrames(args..), 'Expected');
t.end();
});