Created
March 9, 2013 15:53
-
-
Save sevennineteen/5124602 to your computer and use it in GitHub Desktop.
Simple Handlebars helper to dump current context to screen for debugging
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
define(['handlebars'], function (Handlebars) { | |
var templateHelpers = { | |
// Register all defined template helpers | |
load: function () { | |
// Render JSON representation of current context, | |
// e.g., {{{debug this}}} | |
Handlebars.registerHelper('debug', function (context) { | |
return new Handlebars.SafeString( | |
'<div class="debug">' + JSON.stringify(context) + '</div>' | |
); | |
}); | |
} | |
}; | |
return templateHelpers; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment