electrum-store
Advanced tools
Comparing version
@@ -152,2 +152,12 @@ 'use strict'; | ||
}, { | ||
key: 'mutateAll', | ||
value: function mutateAll() { | ||
changeGeneration(this); | ||
const mutation = { generation: this.generation, store: this }; | ||
Object.keys(this._states).forEach(key => { | ||
let state = this._states[key]; | ||
this._states[key] = _state2.default.with(state, mutation); | ||
}); | ||
} | ||
}, { | ||
key: 'merge', | ||
@@ -154,0 +164,0 @@ value: function merge(id, obj) { |
{ | ||
"name": "electrum-store", | ||
"version": "3.1.0", | ||
"version": "3.2.0", | ||
"description": "Electrum store provides a store implementation tailored for Electrum.", | ||
@@ -25,6 +25,6 @@ "main": "lib/index.js", | ||
"devDependencies": { | ||
"babel-env": "^1.2.2", | ||
"generic-js-env": "^1.3.2", | ||
"babel-env": "^1.3.0", | ||
"generic-js-env": "^1.6.1", | ||
"mai-chai": "^2.6.0", | ||
"react": "^15.0.1", | ||
"react": "^15.1.0", | ||
"require-self": "^0.1.0", | ||
@@ -31,0 +31,0 @@ "rimraf": "^2.5.2" |
@@ -227,3 +227,3 @@ # Electrum Store | ||
// Properties year/name will be set on node 12 directly | ||
// Properties year/name will be set on node 12 directly | ||
store.applyChanges ('root', array); | ||
@@ -257,3 +257,3 @@ expect (store.find ('root.10.year').get ()).to.equal (2016); | ||
// Properties name/age will be set on root node directly, and | ||
// the array will be applied on root too. | ||
// the array will be applied on root too. | ||
store.applyChanges ('root', changes); | ||
@@ -453,1 +453,10 @@ expect (store.find ('root').get ('name')).to.equal ('John'); | ||
``` | ||
## Invalidate full store | ||
If for some reason, you want to trigger a full update of the UI, | ||
you might need to mark all nodes in the store as being dirty by | ||
mutating them. | ||
This can be done by calling `store.mutateAll()`. Every state in | ||
the store will be cloned and its generation will be updated. |
@@ -135,2 +135,11 @@ 'use strict'; | ||
mutateAll () { | ||
changeGeneration (this); | ||
const mutation = {generation: this.generation, store: this}; | ||
Object.keys (this._states).forEach (key => { | ||
let state = this._states[key]; | ||
this._states[key] = State.with (state, mutation); | ||
}); | ||
} | ||
merge (id, obj) { | ||
@@ -189,4 +198,4 @@ // Merges changes described as an object. | ||
// child node. | ||
const value = typeof obj.value === 'object' | ||
? undefined | ||
const value = typeof obj.value === 'object' ? | ||
undefined | ||
: obj.value; | ||
@@ -198,10 +207,10 @@ | ||
.set ('offset', obj.offset, 'id', obj.id, 'value', value); | ||
this.applyChanges (childId, obj.value, defaultKey); | ||
} | ||
}); | ||
return; | ||
} | ||
// {x: ..., y: ...} or {$apply: ..., x: ..., y: ...} | ||
@@ -229,3 +238,3 @@ if (typeof obj === 'object') { | ||
}); | ||
return; | ||
@@ -245,6 +254,6 @@ } | ||
}); | ||
return; | ||
} | ||
// plain value | ||
@@ -286,3 +295,3 @@ this | ||
/* static methods */ | ||
/* static methods */ | ||
@@ -289,0 +298,0 @@ static create (id, values) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
115439
1.84%30
3.45%2543
1.84%460
2%