Skip to content

Two auto_refresh extensions#73

Open
stephan-buckmaster wants to merge 5 commits intotrvsdnn:masterfrom
stephan-buckmaster:master
Open

Two auto_refresh extensions#73
stephan-buckmaster wants to merge 5 commits intotrvsdnn:masterfrom
stephan-buckmaster:master

Conversation

@stephan-buckmaster
Copy link

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:

  1. The watch_dir which is used for Frank::Middleware::Refresh did not allow any configuration (couldn't watch for changes in my lib directory)
  2. When computations take a while (>20 sec), the auto_refresh javascript would send multiple refresh requests.

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!

@trvsdnn
Copy link
Owner

trvsdnn commented May 11, 2012

Still thinking on this one. I like the idea of configuring the refresh directories... do think it would be better in setup.rb.

I like the addition of stopping the reload if one is pending, don't know if I like the loading indicator though... Haven't had a chance to see it in action yet though.

@stephan-buckmaster
Copy link
Author

The loading indicator is not graphical, as it may sound. Kind of nice to include a time stamp.

I realized it may be better to have it controlled by an option (enable, disable, how-does-it-work), with disabled by default.

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.

2 participants