Skip to content

Instantly share code, notes, and snippets.

@jcemer
Created June 7, 2012 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jcemer/2889003 to your computer and use it in GitHub Desktop.
Save jcemer/2889003 to your computer and use it in GitHub Desktop.
Coffeescript #troll
raf = 'RequestAnimationFrame'
window['r' + raf[1..]] ?= do ->
return R for pre in ['webkit', 'moz', 'ms', 'o'] when R = window[pre + raf]
# =.=.=.=.=.=.=.=.=.=.=.=.=.=
raf = 'RequestAnimationFrame';
if (window[_name = 'r' + raf.slice(1)] == null) {
window[_name] = (function() {
var R, pre, _i, _len, _ref;
_ref = ['webkit', 'moz', 'ms', 'o'];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
pre = _ref[_i];
if (R = window[pre + raf]) return R;
}
})();
}
do ->
raf = 'RequestAnimationFrame'
window['r' + raf[1..]] ?= do ->
return R for pre in ['webkit', 'moz', 'ms', 'o'] when R = window[pre + raf]
# =.=.=.=.=.=.=.=.=.=.=.=.=.=
(function() {
var raf, _name, _ref;
raf = 'RequestAnimationFrame';
return (_ref = window[_name = 'r' + raf.slice(1)]) != null ? _ref : window[_name] = (function() {
var R, pre, _i, _len, _ref2;
_ref2 = ['webkit', 'moz', 'ms', 'o'];
for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
pre = _ref2[_i];
if (!(R = window[pre + raf])) {}
}
})();
})();
@ricardobeat
Copy link

Ooops. Já ta na grifo a essa hora?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment