pinafore/routes/_store/mixins.js

26 lines
907 B
JavaScript
Raw Normal View History

2018-02-09 06:29:29 +00:00
function timelineMixins (Store) {
2018-01-28 21:09:39 +00:00
Store.prototype.setForTimeline = function (instanceName, timelineName, obj) {
let timelines = this.get('timelines') || {}
let timelineData = timelines[instanceName] || {}
timelineData[timelineName] = Object.assign(timelineData[timelineName] || {}, obj)
timelines[instanceName] = timelineData
this.set({timelines: timelines})
}
Store.prototype.getForTimeline = function (instanceName, timelineName, key) {
let timelines = this.get('timelines') || {}
let timelineData = timelines[instanceName] || {}
return (timelineData[timelineName] || {})[key]
}
Store.prototype.setForCurrentTimeline = function (obj) {
let instanceName = this.get('currentInstance')
let timelineName = this.get('currentTimeline')
this.setForTimeline(instanceName, timelineName, obj)
}
2018-01-28 21:09:39 +00:00
}
2018-02-09 06:29:29 +00:00
export function mixins (Store) {
2018-01-28 21:09:39 +00:00
timelineMixins(Store)
2018-02-09 06:29:29 +00:00
}