Sentry/assets/coffee/sentry.coffee
Gregory Ballantine f88eeafafa
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Added a page for memory stats
2022-05-26 22:28:59 -04:00

22 lines
411 B
CoffeeScript

@loadPage = (pagePath) ->
window.location.href = pagePath + '.html'
@formatBytes = (bytes, decimals = 2) ->
if bytes == 0
return '0 Bytes'
k = 1024
dm = if decimals < 0 then 0 else decimals
sizes = [
'Bytes'
'KB'
'MB'
'GB'
'TB'
'PB'
'EB'
'ZB'
'YB'
]
i = Math.floor(Math.log(bytes) / Math.log(k))
parseFloat((bytes / k ** i).toFixed(dm)) + ' ' + sizes[i]