summaryrefslogtreecommitdiff
path: root/ext/bg/js/util.js
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2017-05-23 21:27:20 -0700
committerAlex Yatskov <alex@foosoft.net>2017-05-23 21:27:20 -0700
commit5de9ac17122002fa8727fd089679394f54af442f (patch)
tree833fecc8b7de8e5f4d476020eeff024abace1037 /ext/bg/js/util.js
parentac406bdbf0d4b275ed8d1c48e29d0cb69e4d1800 (diff)
add debug logging
Diffstat (limited to 'ext/bg/js/util.js')
-rw-r--r--ext/bg/js/util.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/ext/bg/js/util.js b/ext/bg/js/util.js
index 74e1f49e..64c79ab5 100644
--- a/ext/bg/js/util.js
+++ b/ext/bg/js/util.js
@@ -504,6 +504,11 @@ function jsonLoadDb(indexUrl, indexLoaded, termsLoaded, kanjiLoaded) {
* Helpers
*/
+function handlebarsDumpObject(options) {
+ const dump = JSON.stringify(options.fn(this), null, 4);
+ return Handlebars.Utils.escapeExpression(dump);
+}
+
function handlebarsKanjiLinks(options) {
let result = '';
for (const c of options.fn(this)) {
@@ -523,6 +528,7 @@ function handlebarsMultiLine(options) {
function handlebarsRegister() {
Handlebars.partials = Handlebars.templates;
+ Handlebars.registerHelper('dumpObject', handlebarsDumpObject);
Handlebars.registerHelper('kanjiLinks', handlebarsKanjiLinks);
Handlebars.registerHelper('multiLine', handlebarsMultiLine);
}