Skip to content

Commit

Permalink
Merge pull request #14 from Raynos/master
Browse files Browse the repository at this point in the history
moved polyfill into own file
  • Loading branch information
chrisdickinson committed Apr 16, 2014
2 parents 94a31f1 + 25713a9 commit feb0b48
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
14 changes: 1 addition & 13 deletions index.js
@@ -1,25 +1,13 @@
module.exports = raf

var EE = require('events').EventEmitter
, global = typeof window === 'undefined' ? this : window
, _raf = require('./polyfill.js')
, now = global.performance && global.performance.now ? function() {
return performance.now()
} : Date.now || function () {
return +new Date()
}

var _raf =
global.requestAnimationFrame ||
global.webkitRequestAnimationFrame ||
global.mozRequestAnimationFrame ||
global.msRequestAnimationFrame ||
global.oRequestAnimationFrame ||
(global.setImmediate ? function(fn, el) {
setImmediate(fn)
} :
function(fn, el) {
setTimeout(fn, 0)
})

function raf(el, tick) {
var now = raf.now()
Expand Down
16 changes: 16 additions & 0 deletions polyfill.js
@@ -0,0 +1,16 @@
var global = typeof window === 'undefined' ? this : window

var _raf =
global.requestAnimationFrame ||
global.webkitRequestAnimationFrame ||
global.mozRequestAnimationFrame ||
global.msRequestAnimationFrame ||
global.oRequestAnimationFrame ||
(global.setImmediate ? function(fn, el) {
setImmediate(fn)
} :
function(fn, el) {
setTimeout(fn, 0)
})

module.exports = _raf

0 comments on commit feb0b48

Please sign in to comment.