Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hey, I use frank for turning results of my computations into HTML which I look at in my browser.
I put computation code in the lib directory, and place display in dynamic templates. I work by making small changes to the inputs, or extend the computation code. The auto_refresh feature makes it so that a file-save becomes similar to a "return" in a terminal: the results of the computation, from new code or display-changes, show up in my browser immediately.
This works all very nice. I ran into two issues though, and am submitting the changes that fix them:
For (1) I allowed configuration by reading an environment variable "FRANK_REFRESH_DIRS" the contents of which are appended to the "watch_dirs" variable
For (2) I added a javascript variable "loading" which is set when the page is reloaded, and prevents any further reloads. While the new page is loading, a more-or-less fancy loading indicator section is displayed on the page. Automatic refresh can be disabled through simple javascript "window.stop_refresh_check = true"
Spec changes cover (2). Couldn't find a way to add specs for (1). Might be better to provide for a hook to use in setup.rb (Frank::Middleware::Refresh.add_watch_directory 'lib') anyway
Cheers!