Last active
December 13, 2015 18:18
-
-
Save kitmenke/4953860 to your computer and use it in GitHub Desktop.
Custom JsRender debug tag
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
/** | |
* Custom JsRender debug tag | |
* Log a message and an object to the console. | |
* Usage: {{debug #parent message='Inside the for loop'/}} | |
**/ | |
$.views.tags({ | |
debug: function(obj) { | |
var props = this.props; | |
// output a default message if the user didn't specify a message | |
var msg = props.message || 'Debug:'; | |
console.log(msg, obj); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment