| 102 | } |
| 103 | |
| 104 | private locatePostable(postable: WorkflowPostable): PostableIndices { |
| 105 | let result = { |
| 106 | isInMilestone: false, |
| 107 | isInEpilogue: false, |
| 108 | } as PostableIndices; |
| 109 | for (let i = 0; i < this.milestones.length; i++) { |
| 110 | let milestone = this.milestones[i]; |
| 111 | let postIndex = milestone.indexOf(postable); |
| 112 | if (postIndex > -1) { |
| 113 | result.isInMilestone = true; |
| 114 | result.milestoneIndex = i; |
| 115 | result.collectionIndex = postIndex; |
| 116 | break; |
| 117 | } |
| 118 | } |
| 119 | let postIndexInEpilogue = this.epilogue.indexOf(postable); |
| 120 | if (postIndexInEpilogue > -1) { |
| 121 | result.isInEpilogue = true; |
| 122 | result.collectionIndex = postIndexInEpilogue; |
| 123 | } |
| 124 | return result; |
| 125 | } |
| 126 | |
| 127 | on(event: string, cb: Function) { |
| 128 | return this.simpleEmitter.on(event, cb); |