2018-03-03 23:15:50 +01:00
|
|
|
export function instanceMixins (Store) {
|
2018-03-03 23:51:48 +01:00
|
|
|
Store.prototype.setComposeData = function (realm, obj) {
|
2018-04-19 18:37:05 +02:00
|
|
|
let { composeData, currentInstance } = this.get()
|
|
|
|
let instanceNameData = composeData[currentInstance] = composeData[currentInstance] || {}
|
2018-03-03 23:51:48 +01:00
|
|
|
instanceNameData[realm] = Object.assign(instanceNameData[realm] || {}, obj)
|
2018-08-30 06:42:57 +02:00
|
|
|
this.set({ composeData })
|
2018-03-03 23:15:50 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
Store.prototype.getComposeData = function (realm, key) {
|
2018-04-19 18:37:05 +02:00
|
|
|
let { composeData, currentInstance } = this.get()
|
|
|
|
return composeData[currentInstance] &&
|
|
|
|
composeData[currentInstance][realm] &&
|
|
|
|
composeData[currentInstance][realm][key]
|
2018-03-03 23:15:50 +01:00
|
|
|
}
|
2018-03-05 01:27:15 +01:00
|
|
|
|
|
|
|
Store.prototype.clearComposeData = function (realm) {
|
2018-04-19 18:37:05 +02:00
|
|
|
let { composeData, currentInstance } = this.get()
|
|
|
|
if (composeData && composeData[currentInstance]) {
|
|
|
|
delete composeData[currentInstance][realm]
|
2018-03-05 01:27:15 +01:00
|
|
|
}
|
2018-08-30 06:42:57 +02:00
|
|
|
this.set({ composeData })
|
2018-03-05 01:27:15 +01:00
|
|
|
}
|
2018-03-03 23:15:50 +01:00
|
|
|
}
|