@lightsource/bem-block
v2.0.1
Published
Helper for BEM blocks, it will be auto creating instances per each block, supports dynamic content (like ajax) thanks to MutationObserver.
Readme
Bem block
What is it
Helper for BEM blocks, it will be auto creating instances per each block, supports dynamic content (like ajax) thanks to MutationObserver.
Installation
yarn add @lightsource/bem-blockOR
npm install @lightsource/bem-blockExample of usage
import bemBlock from '@lightsource/bem-block';
class Start extends bemBlock.Class {
//////// constructor
constructor(element) {
super(element);
// TODO add listeners, etc..
}
}
bemBlock.Register('.start', Start);Also an error callback is available (e.g. for cases when a passed class link is wrong)
bemBlock.settings.ERROR_CALLBACK = function (errors) {
// TODO
}; 