cartodb-4.42/lib/assets/javascripts/builder/editor/components/overlay/overlay-view.js
2024-04-06 05:25:13 +00:00

23 lines
582 B
JavaScript
Executable File

var CoreView = require('backbone/core-view');
var template = require('./overlay.tpl');
module.exports = CoreView.extend({
initialize: function (opts) {
if (!opts.overlayModel) throw new Error('overlayModel is required');
this.overlayModel = opts.overlayModel;
this._initBinds();
},
render: function () {
this.$el.empty();
this.$el.append(template({
visible: !this.overlayModel.get('visible') ? 'is-hidden' : ''
}));
return this;
},
_initBinds: function () {
this.listenTo(this.overlayModel, 'change:visible', this.render);
}
});