Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hostess infinite implementation #67

Merged
merged 10 commits into from Oct 5, 2020

Conversation

MalditoBarbudo
Copy link
Contributor

Related to issue: #65

I have a working version with infinite capability for Hostess.
I had to create a $close() method similiar to the waitress one, to be able to send an end signal to the ldBar element, as in the original code the bar was only closed when reaching 100%.
This means that when using the infinite switch, the Hostess object must be closed when the calculations end:

### waiter + hostess normal
library(shiny)
library(waiter)

ui <- fluidPage(
  use_waiter(),
  use_hostess(),
  waiter_show_on_load(
    color = "#f7fff7",
    hostess_loader(
      "loader", 
      preset = "circle", 
      text_color = "black",
      class = "label-center",
      center_page = TRUE
    )
  )
)

server <- function(input, output){
  hostess <- Hostess$new("loader", infinite = TRUE)
  
  # for(i in 1:10){
  #   Sys.sleep(runif(1) / 2)
  #   hostess$set(i * 10)
  # }
  hostess$start()
  Sys.sleep(5)
  hostess$close()
  waiter_hide()
}

shinyApp(ui, server)

I have also updated the documentation in docs/hostess.md to add some examples using infinite, and ran all the hostess examples in the docs to check they are still working with the new changes. All seems ok, but maybe something is missed, let me know if it is ok.

JohnCoene added a commit that referenced this pull request Oct 5, 2020
@JohnCoene JohnCoene merged commit a48fcef into JohnCoene:master Oct 5, 2020
@JohnCoene
Copy link
Owner

@MalditoBarbudo amazingly done!

I like the setting the bar to 95 since there is not close, works like a charm!

@MalditoBarbudo
Copy link
Contributor Author

@JohnCoene Thanks! I thought it was a nice touch for short/medium computations, that way the bar doesn't end so abruptly :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants