GetPercentage returns the loading percentage (0-100)
()
| 58 | |
| 59 | // GetPercentage returns the loading percentage (0-100) |
| 60 | func (lp *LoadProgress) GetPercentage() float64 { |
| 61 | if lp.TotalBytes <= 0 { |
| 62 | return 0 |
| 63 | } |
| 64 | percent := float64(lp.LoadedBytes) * 100.0 / float64(lp.TotalBytes) |
| 65 | if percent > 100 { |
| 66 | percent = 100 |
| 67 | } |
| 68 | return percent |
| 69 | } |
| 70 | |
| 71 | // SearchResult represents a cell that matches search query |
| 72 | type SearchResult struct { |
no outgoing calls
no test coverage detected