Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
try {
// These properties will be exposed under this.props
// Note that these properties are reactively recalculated
let timeline = transformTimeline(
Timeline.find({
studioId: props.studioId
}, { sort: { _id: 1 } }).fetch()
)
// console.log('rerun')
// TODO - dont repeat unless changed
let tl = Resolver.resolveTimeline(timeline, { time: now })
let allStates = Resolver.resolveAllStates(tl)
let state = Resolver.getState(allStates, now)
return {
now: now,
state: state
}
} catch (e) {
return {
now: now,
errorMsg: `Failed to update timeline:\n${e}`
}
}
})(
class extends MeteorReactComponent {
const objs: Array = pieces.map(piece => {
const obj = createPieceGroup(piece)
// If start is now, then if the part is active set it to be now, or fallback to start of the part
if (piece.enable.start === 'now') {
piece.enable.start = targetTime
}
return obj
})
const resolved = Resolver.resolveTimeline(transformTimeline(objs), {
time: targetTime
})
const state = Resolver.getState(resolved, targetTime, 1)
let unresolvedIds: string[] = []
let unresolvedCount = resolved.statistics.unresolvedCount
_.each(resolved.objects, obj0 => {
if (!obj0.resolved.resolved || !obj0.resolved.instances || obj0.resolved.instances.length === 0) {
const obj = obj0 as any as TimelineObjRundown
const pieceId = (obj.metadata || {}).pieceId
const piece = itemMap[pieceId]
if (piece && piece.virtual) {
// Virtuals always are unresolved and should be ignored
unresolvedCount -= 1
} else {
unresolvedIds.push(obj.id)
}
}
})
export const ComponentTimelineSimulate = withTracker(() => {
// These properties will be exposed under this.props
// Note that these properties are reactively recalculated
let timeline = transformTimeline(
Timeline.find({}, { sort: { _id: 1 } }).fetch()
)
// pre-process the timeline
let now = getCurrentTimeReactive()
let tl = Resolver.getTimelineInWindow(timeline)
let state = Resolver.getState(tl, now)
return {
now: now,
state: state
}
})(
class extends MeteorReactComponent {