pinafore/routes/_store/computations/timelineComputations.js

24 lines
1.1 KiB
JavaScript
Raw Normal View History

2018-02-11 17:37:13 +00:00
function computeForTimeline (store, key) {
store.compute(key, ['currentTimelineData'], (currentTimelineData) => currentTimelineData[key])
}
2018-02-09 06:29:29 +00:00
export function timelineComputations (store) {
2018-01-28 21:09:39 +00:00
store.compute('currentTimelineData', ['currentInstance', 'currentTimeline', 'timelines'],
(currentInstance, currentTimeline, timelines) => {
return ((timelines && timelines[currentInstance]) || {})[currentTimeline] || {}
})
computeForTimeline(store, 'timelineItemIds')
computeForTimeline(store, 'runningUpdate')
computeForTimeline(store, 'initialized')
computeForTimeline(store, 'lastFocusedElementSelector')
computeForTimeline(store, 'ignoreBlurEvents')
2018-02-11 21:46:57 +00:00
computeForTimeline(store, 'itemIdsToAdd')
2018-02-12 03:15:21 +00:00
computeForTimeline(store, 'showHeader')
computeForTimeline(store, 'shouldShowHeader')
store.compute('firstTimelineItemId', ['timelineItemIds'], (timelineItemIds) => timelineItemIds && timelineItemIds.length && timelineItemIds[0])
2018-02-09 02:54:48 +00:00
store.compute('lastTimelineItemId', ['timelineItemIds'], (timelineItemIds) => timelineItemIds && timelineItemIds.length && timelineItemIds[timelineItemIds.length - 1])
2018-02-09 06:29:29 +00:00
}