@veams/base
v1.0.3
Published
Base Class for Components and Services
Downloads
298
Readme
Base (@veams/base)
Base Class for Components and Services which will be used in Veams projects.
Features
- Deep merge support for option objects
- Unique id generation
- mixin support
- TypeScript support
Installation
NPM
npm install @veams/base --save
Yarn
yarn add @veams/base
Usage
class Test extends Base {
constructor(obj) {
let options = {
selectors: {
'container': '.test',
'btn': '.btn-danger'
},
classes: {
active: 'is-active'
}
};
super(obj, options);
}
}
const test = new Test({
// el: $(''),
namespace: 'test',
options: {
selectors: {
'container': '.container'
}
}
});
Output
{
"_namespace": "test",
"_instanceId": "test_1518477164034_266f9fa5-6faf-064b-7d2e-e23cfaf2855e",
"options": {
"selectors": {
"test": ".container",
"btn": ".btn-danger"
},
"classes": {
"active": "is-active"
}
},
"_el": {}
}