godoc comments
Vladimir Bauer
4 years ago
| 154 | 154 | } |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | // EnableTriggerComplete enables triggering complete event by increment | |
| 158 | // methods or triggers it now if bar already has been incremented up | |
| 159 | // to the total. Triggering complete event is auto disabled if bar | |
| 160 | // constructed with `total <= 0`. | |
| 157 | // EnableTriggerComplete enables triggering complete event. It's | |
| 158 | // effective only for bar which was constructed with `total <= 0`. | |
| 159 | // If bar has been incremented to the total, complete event is | |
| 160 | // triggered right away. | |
| 161 | 161 | func (b *Bar) EnableTriggerComplete() { |
| 162 | 162 | select { |
| 163 | 163 | case b.operateState <- func(s *bState) { |
| 176 | 176 | } |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | // SetTotal sets total to an arbitrary value. Setting it to negative | |
| 180 | // value is equivalent to (*Bar).SetTotal((*Bar).Current(), bool). If | |
| 181 | // triggerCompleteNow is true, current value is set to total and | |
| 182 | // complete event is triggered right away. | |
| 179 | // SetTotal sets total to an arbitrary value. It's effective only for | |
| 180 | // bar which was constructed with `total <= 0`. Setting total to negative | |
| 181 | // value is equivalent to (*Bar).SetTotal((*Bar).Current(), bool). | |
| 182 | // If triggerCompleteNow is true then total value is set to current | |
| 183 | // and complete event is triggered right away. | |
| 183 | 184 | func (b *Bar) SetTotal(total int64, triggerCompleteNow bool) { |
| 184 | 185 | select { |
| 185 | 186 | case b.operateState <- func(s *bState) { |