Created
August 31, 2011 18:22
-
-
Save wesbos/1184274 to your computer and use it in GitHub Desktop.
log - Coffeescript version of Paul Irish's log() Wrapper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Based on http://paulirish.com/2009/log-a-lightweight-wrapper-for-consolelog/ | |
# Converter to coffeescript by Wes Bos - http://wesbos.com | |
window.log = -> | |
log.history = log.history or [] | |
log.history.push arguments | |
console.log Array::slice.call arguments if @console | |
return |
Ah, good idea :) - Updated!
Thanks, was looking for it!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can use
::
as an alias for prototype.console.log Array::slice.call arguments if @console
And you can omit the last return, it's fairly useless for most uses of
log()
. :)