Closed ignovak closed 9 years ago
Now, if I need to return empty value instead of block in some cases, I have to write some redundant code:
// old implementation using "blocks" blocks['my-block'] = function(data) { if (!data.myData) return ''; return { blocks: 'my-block', content: data.myData }; } // "bempriv" implementation BEMPRIV.decl('my-block', { init: function() { if (!this.data.myData) return; this.content(this.data.myData); }, bemjson: function() { if (this.data.myData) { return this.__base(); } } }
Probably, it worth to implement some way to reach that without overloading bemjson method.
@ignovak take a look https://github.com/sbmaxx/bem-priv/pull/19
Now, if I need to return empty value instead of block in some cases, I have to write some redundant code:
Probably, it worth to implement some way to reach that without overloading bemjson method.