diff --git a/src/ObjectDisplay.js b/src/ObjectDisplay.js index b637f7e2..3f047c73 100644 --- a/src/ObjectDisplay.js +++ b/src/ObjectDisplay.js @@ -4,6 +4,8 @@ const displayBlock = require('./displayBlock') module.exports = class ObjectDisplay { constructor ({feature, category, dom, displayId, fallbackIds}, callback) { + this.category = category + if (!fallbackIds) { fallbackIds = [] } @@ -49,6 +51,13 @@ module.exports = class ObjectDisplay { body.innerHTML = result feature.sublayer.updateAssets(body, feature) }) + + category.on('update', this.updateListener = () => { + category.renderTemplate(feature, displayId + 'Body', (err, result) => { + body.innerHTML = result + feature.sublayer.updateAssets(body, feature) + }) + }) displayBlock({ dom, @@ -104,6 +113,9 @@ module.exports = class ObjectDisplay { } close () { + if (this.updateListener) { + this.category.off('update', this.updateListener) + } } }