2018-03-03 22:15:50 +00:00
|
|
|
export function instanceMixins (Store) {
|
2018-03-03 22:51:48 +00:00
|
|
|
Store.prototype.setComposeData = function (realm, obj) {
|
2018-03-03 22:15:50 +00:00
|
|
|
let composeData = this.get('composeData')
|
|
|
|
let instanceName = this.get('currentInstance')
|
2018-03-03 22:51:48 +00:00
|
|
|
let instanceNameData = composeData[instanceName] = composeData[instanceName] || {}
|
|
|
|
instanceNameData[realm] = Object.assign(instanceNameData[realm] || {}, obj)
|
2018-03-03 22:15:50 +00:00
|
|
|
this.set({composeData})
|
|
|
|
}
|
|
|
|
|
|
|
|
Store.prototype.getComposeData = function (realm, key) {
|
|
|
|
let composeData = this.get('composeData')
|
|
|
|
let instanceName = this.get('currentInstance')
|
|
|
|
return composeData[instanceName] &&
|
|
|
|
composeData[instanceName][realm] &&
|
|
|
|
composeData[instanceName][realm][key]
|
|
|
|
}
|
2018-03-05 00:27:15 +00:00
|
|
|
|
|
|
|
Store.prototype.clearComposeData = function (realm) {
|
|
|
|
let composeData = this.get('composeData')
|
|
|
|
let instanceName = this.get('currentInstance')
|
|
|
|
if (composeData && composeData[instanceName]) {
|
|
|
|
delete composeData[instanceName][realm]
|
|
|
|
}
|
|
|
|
this.set({composeData})
|
|
|
|
}
|
2018-03-03 22:15:50 +00:00
|
|
|
}
|