Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
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 2 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.