var BemPopupMixin = {
    blockDidMount: function(block) {
        block.on({modName: 'visible', modVal: '*'}, function(event, data) {
            this.callHandler(data.modVal ? 'open' : 'close', {target: block});
        }.bind(this));
    },

    open: function() {
        this.block.setMod('visible', true);
    },

    close: function() {
        this.block.setMod('visible', false);
    }
};

module.exports = BemPopupMixin;
