Sentry/assets/coffee/sentry.coffee

22 lines
411 B
CoffeeScript
Raw Normal View History

2022-05-25 14:28:19 -04:00
@loadPage = (pagePath) ->
window.location.href = pagePath + '.html'
2022-05-26 22:28:59 -04:00
@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]