8d5690d63d
* remove get() with string pt 1 * remove get() with string pt 2 * fix typo * fix some null exceptions in get() * fixup code style
24 lines
867 B
JavaScript
24 lines
867 B
JavaScript
export function instanceMixins (Store) {
|
|
Store.prototype.setComposeData = function (realm, obj) {
|
|
let { composeData, currentInstance } = this.get()
|
|
let instanceNameData = composeData[currentInstance] = composeData[currentInstance] || {}
|
|
instanceNameData[realm] = Object.assign(instanceNameData[realm] || {}, obj)
|
|
this.set({composeData})
|
|
}
|
|
|
|
Store.prototype.getComposeData = function (realm, key) {
|
|
let { composeData, currentInstance } = this.get()
|
|
return composeData[currentInstance] &&
|
|
composeData[currentInstance][realm] &&
|
|
composeData[currentInstance][realm][key]
|
|
}
|
|
|
|
Store.prototype.clearComposeData = function (realm) {
|
|
let { composeData, currentInstance } = this.get()
|
|
if (composeData && composeData[currentInstance]) {
|
|
delete composeData[currentInstance][realm]
|
|
}
|
|
this.set({composeData})
|
|
}
|
|
}
|