From e36b00c956b0c8c2973ae7fe1a191b122e99338e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20B=C3=B6sch-Plepelits?= Date: Tue, 12 Sep 2017 15:03:49 +0200 Subject: [PATCH] Call hook 'show-details' --- README.md | 1 + src/index.js | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/README.md b/README.md index e03454ce..af0edbb9 100644 --- a/README.md +++ b/README.md @@ -118,3 +118,4 @@ With the function `register_hook` you can hook into several functions. The follo * `state-get`: modules can add values into the current state. Parameters: `state`: an object, which can be modified by modules. * `state-apply`: when a state is applied to the app. Parameters: `state`: state which should be applied. +* `show-details`: called when details are being displayed. Parameters: data (see properties in doc/TwigJS.md), category, dom, callback. diff --git a/src/index.js b/src/index.js index f104df58..0d66d54e 100644 --- a/src/index.js +++ b/src/index.js @@ -228,6 +228,15 @@ function showDetails (data, category) { div.innerHTML = result }.bind(this, div)) + + call_hooks_callback('show-details', data, category, dom, + function (err) { + if (err.length) { + console.log('show-details produced errors:', err) + } + } + ) + h = document.createElement('h3') h.innerHTML = 'Attributes' dom.appendChild(h)