Last active
August 27, 2022 02:32
-
-
Save CorradoLanera/1bfa199fe347d45a25a93058053fbf11 to your computer and use it in GitHub Desktop.
I have finally found the Windows progress bar hidden algorithm!!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
update_windows <- function() { | |
pb <- progress::progress_bar$new( | |
total = 100, | |
format = "(:spin) :what [:bar] :perc", | |
clear = FALSE, | |
width = 80 | |
) | |
i <- 1 | |
p <- numeric(1) | |
usethis::ui_info("Windows is updating") | |
usethis::ui_info( | |
"Updates are underway to keep things running smootly!" | |
) | |
usethis::ui_todo( | |
"Please, keep your computer on and plugged in." | |
) | |
on.exit({ | |
cat("\n") | |
usethis::ui_done("Updates completed!") | |
Sys.sleep(3) | |
usethis::ui_stop("NO PANIC!") | |
}) | |
while (TRUE) { | |
p[[1L]] <- round(1 - 1/i, 2 + log10(i)) | |
pb$update( | |
p, | |
tokens = list( | |
what = "We are quite there!", | |
perc = paste0(100 * p, "%") | |
) | |
) | |
Sys.sleep(0.4) | |
i[[1L]] <- i[[1L]] + 1L | |
} | |
} | |
update_windows() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment