fix animations and cleanup store/component get() usage (#185)
fixes #181
This commit is contained in:
parent
bfc3c46462
commit
77ba91c712
|
@ -107,7 +107,7 @@
|
||||||
export default {
|
export default {
|
||||||
oncreate () {
|
oncreate () {
|
||||||
this.observe('animation', animation => {
|
this.observe('animation', animation => {
|
||||||
let reduceMotion = this.store.get()
|
let { reduceMotion } = this.store.get()
|
||||||
if (!animation || reduceMotion) {
|
if (!animation || reduceMotion) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ export class LocalStorageStore extends Store {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
Object.keys(this._keysToSave).forEach(key => {
|
Object.keys(this._keysToSave).forEach(key => {
|
||||||
LS.setItem(`store_${key}`, JSON.stringify(this.get(key)))
|
LS.setItem(`store_${key}`, JSON.stringify(this.get()[key]))
|
||||||
})
|
})
|
||||||
this._keysToSave = {}
|
this._keysToSave = {}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ export function timelineMixins (Store) {
|
||||||
let valuesToSet = {}
|
let valuesToSet = {}
|
||||||
for (let key of Object.keys(obj)) {
|
for (let key of Object.keys(obj)) {
|
||||||
let rootKey = `timelineData_${key}`
|
let rootKey = `timelineData_${key}`
|
||||||
let root = this.get(rootKey) || {}
|
let root = this.get()[rootKey] || {}
|
||||||
let instanceData = root[instanceName] = root[instanceName] || {}
|
let instanceData = root[instanceName] = root[instanceName] || {}
|
||||||
instanceData[timelineName] = obj[key]
|
instanceData[timelineName] = obj[key]
|
||||||
valuesToSet[rootKey] = root
|
valuesToSet[rootKey] = root
|
||||||
|
@ -16,7 +16,7 @@ export function timelineMixins (Store) {
|
||||||
|
|
||||||
Store.prototype.getForTimeline = function (instanceName, timelineName, key) {
|
Store.prototype.getForTimeline = function (instanceName, timelineName, key) {
|
||||||
let rootKey = `timelineData_${key}`
|
let rootKey = `timelineData_${key}`
|
||||||
let root = this.get(rootKey)
|
let root = this.get()[rootKey]
|
||||||
return root && root[instanceName] && root[instanceName][timelineName]
|
return root && root[instanceName] && root[instanceName][timelineName]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ export function timelineMixins (Store) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Store.prototype.getAllTimelineData = function (instanceName, key) {
|
Store.prototype.getAllTimelineData = function (instanceName, key) {
|
||||||
let root = this.get(`timelineData_${key}`) || {}
|
let root = this.get()[`timelineData_${key}`] || {}
|
||||||
return root[instanceName] || {}
|
return root[instanceName] || {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,8 +17,7 @@ export class RealmStore extends Store {
|
||||||
}
|
}
|
||||||
|
|
||||||
setForRealm (obj) {
|
setForRealm (obj) {
|
||||||
let { currentRealm } = this.get()
|
let { currentRealm, realms } = this.get()
|
||||||
let { realms } = this.get()
|
|
||||||
realms.set(currentRealm, Object.assign(realms.get(currentRealm) || {}, obj))
|
realms.set(currentRealm, Object.assign(realms.get(currentRealm) || {}, obj))
|
||||||
this.set({realms: realms})
|
this.set({realms: realms})
|
||||||
}
|
}
|
||||||
|
@ -58,7 +57,7 @@ export class RealmStore extends Store {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
mark('batchUpdate')
|
mark('batchUpdate')
|
||||||
let obj = this.get(key)
|
let obj = this.get()[key]
|
||||||
for (let otherKey of updatedKeys) {
|
for (let otherKey of updatedKeys) {
|
||||||
obj[otherKey] = batch[otherKey]
|
obj[otherKey] = batch[otherKey]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue