Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
bem-promised-models
Advanced tools
BEM wrapper for promised-models2
priv.js
with bem-node's i-state
$ npm install --save bem-promised-models
Add node_modules/bem-promised-models/blocks
to your levels lists
Add deps for promised-models
({
mustDeps: [
{block: 'promised-models', elems: ['model', 'registry', 'registry-storage']}
]
})
For noBEM setups use promised-models2
BEM.Model.decl('fashion-model', {
attributes: {
name: {
type: 'String'
}
}
});
var model = BEM.blocks['fashion-model'].create({
name: 'Kate'
});
model.get('name'); //Kate
Add declaration for existent one:
BEM.Model.decl('fashion-model', {
attributes: {
sename: {
type: 'String'
}
},
getFullName: function () {
return [this.get('name') + this.get('sename')].join(' ');
}
});
var model = BEM.blocks['fashion-model'].create({
name: 'Kate',
sename: 'Moss'
});
model.getFullName(); //Kate Moss
Inherit:
BEM.Model.decl('uppercased-model', 'fashion-model', {
getFullName: function () {
return this.__base().toUpperCase();
}
});
BEM.Model.decl('podium', {
attributes: {
//nested
currentModel: {
type: 'Model',
modelType: 'fashion-model'
},
//collections
avaibleModels: {
type: 'ModelsList',
modelType: 'fashion-model'
}
}
});
//bh template
var model = BEM.blocks['fashion-model'].create();
ctx.content({
block: 'view',
js: {
modelId: model.cid
}
});
//BEM.DOM declaration
var model = BEM.blocks['fashion-model'].getOne(this.params.modelId);
var model = BEM.blocks['fashion-model'].getAny(this.params.mongoId);
//load data from storage
model.fetch().done();
BEM.Model.decl('fashion-model', {
storage: {
insert: function (model) {
//...
},
update: function (model) {
//...
},
find: function (model) {
//...
},
remove: function (model) {
//...
}
}
});
.decl(modelName, [baseModel], [properties], [staticProperties])
Add model declaration
.getOne([cid])
Get model instance by client id model.cid
.create([id], [data])
Create model instance with storage id and data
.getOne([cid])
Get model instance of current class by client id model.cid
.getAny([id])
Get model instance by storage id model.id
. If no instance with id
was found, create new one.
See promised-models2
FAQs
BEM wrapper for promised-models
The npm package bem-promised-models receives a total of 53 weekly downloads. As such, bem-promised-models popularity was classified as not popular.
We found that bem-promised-models demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.