Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bem-promised-models

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bem-promised-models - npm Package Compare versions

Comparing version 0.0.18 to 0.0.19

28

blocks/promised-models/__model/promised-models__model.js

@@ -384,3 +384,3 @@ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){

var model = this;
return fulfill().then(function () {
return this.ready().then(function () {
return model.storage.find(model);

@@ -604,5 +604,9 @@ }).then(function (data) {

calculate: function () {
var model = this;
if (this.isReady()) {
this.trigger('calculate');
this._readyPromise = this._calculate();
//start _calculate on next tick
this._readyPromise = fulfill().then(function () {
return model._calculate();
});
} else {

@@ -649,2 +653,4 @@ this._requireMoreCalculations = true;

this._requireMoreCalculations = false;
model.commit(model.CALCULATIONS_BRANCH);

@@ -668,3 +674,4 @@

]).spread(function (calculateData) {
model.set(calculateData);
model._setCalculatedData(calculateData);
// model.set(calculateData);
if (model._checkContinueCalculations()) {

@@ -682,6 +689,15 @@ return model._calculate(++n);

/**
* setting calculated data only if nothing have changed during calculations
* otherwise we will have racing conditions(
* @param {object} calculateData
*/
_setCalculatedData: function (calculateData) {
if (!this._checkContinueCalculations()) {
this.set(calculateData);
}
},
_checkContinueCalculations: function () {
var toContinue = this.isChanged(this.CALCULATIONS_BRANCH) || this._requireMoreCalculations;
this._requireMoreCalculations = false;
return toContinue;
return this.isChanged(this.CALCULATIONS_BRANCH) || this._requireMoreCalculations;
},

@@ -688,0 +704,0 @@

{
"description": "BEM wrapper for promised-models",
"name": "bem-promised-models",
"version": "0.0.18",
"version": "0.0.19",
"repository": "git@github.com:delfrrr/bem-promised-models.git",

@@ -31,3 +31,3 @@ "keywords": [

"dependencies": {
"promised-models": "0.0.16"
"promised-models": "0.0.17"
},

@@ -34,0 +34,0 @@ "devDependencies": {

@@ -106,3 +106,3 @@ # bem-promised-models

### Pass models by client id (for broser render only)
### Pass models by client id (for browser render only)

@@ -162,3 +162,3 @@ ```

Adds model declaration
Add model declaration

@@ -181,3 +181,3 @@ #### `.getOne([cid])`

Get model instance by storage id `model.id`. If no instance with `id` was found, creates new one.
Get model instance by storage id `model.id`. If no instance with `id` was found, create new one.

@@ -184,0 +184,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc