Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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 {
function getOrderedPiece (line: Part): Array {
const items = line.getAllPieces()
const itemMap: { [key: string]: Piece } = {}
items.forEach(i => itemMap[i._id] = i)
const objs: Array = items.map(
i => clone(createPieceGroup(i, i.durationOverride || i.duration || i.expectedDuration || 0))
)
objs.forEach(o => {
if (o.trigger.type === TriggerType.TIME_ABSOLUTE && (o.trigger.value === 0 || o.trigger.value === 'now')) {
o.trigger.value = 100
}
})
const tlResolved = Resolver.getTimelineInWindow(transformTimeline(objs))
let resolvedItems: Array = []
_.each(tlResolved.resolved, e => {
const id = ((e as any || {}).metadata || {}).pieceId
let item = _.clone(itemMap[id]) as PieceResolved
item.resolvedStart = e.resolved.startTime || 0
item.resolved = true
resolvedItems.push(item)
})
_.each(tlResolved.unresolved, e => {
const id = ((e as any || {}).metadata || {}).pieceId
let item = _.clone(itemMap[id]) as PieceResolved
item.resolvedStart = 0
item.resolved = false
function getResolvedPieces (line: Part): Piece[] {
const items = line.getAllPieces()
const itemMap: { [key: string]: Piece } = {}
items.forEach(i => itemMap[i._id] = i)
const objs = items.map(i => clone(createPieceGroup(i, i.durationOverride || i.duration || i.expectedDuration || 0)))
objs.forEach(o => {
if (o.trigger.type === TriggerType.TIME_ABSOLUTE && (o.trigger.value === 0 || o.trigger.value === 'now')) {
o.trigger.value = 1
}
})
const events = Resolver.getTimelineInWindow(transformTimeline(objs))
let eventMap = events.resolved.map(e => {
const id = ((e as any || {}).metadata || {}).pieceId
return {
start: e.resolved.startTime || 0,
end: e.resolved.endTime || 0,
id: id,
item: itemMap[id]
}
})
events.unresolved.forEach(e => {
const id = ((e as any || {}).metadata || {}).pieceId
eventMap.push({
start: 0,
end: 0,
id: id,