tune javascript refresh delays
WebApp now shows changes with no delay. Comparing a running git-annex get and the webapp side-by-side, they both show each new transfer at the same time.
This commit is contained in:
parent
6a9abf6526
commit
9b18dc2a39
1 changed files with 7 additions and 7 deletions
|
@ -95,14 +95,14 @@ instance Yesod WebApp where
|
||||||
- Or, the home route is used if the whole page has to be refreshed to
|
- Or, the home route is used if the whole page has to be refreshed to
|
||||||
- update.
|
- update.
|
||||||
-
|
-
|
||||||
- ms_delay is how long to delay between updates.
|
- ms_delay is how long to delay between AJAX updates
|
||||||
- ms_startdelay is how long to delay before updating the widget at the
|
- ms_startdelay is how long to delay before updating with AJAX at the start
|
||||||
- state.
|
- ms_refreshdelay is how long to delay between refreshes, when not using AJAX
|
||||||
-}
|
-}
|
||||||
autoUpdate :: Text -> Route WebApp -> Route WebApp -> Int -> Int -> Widget
|
autoUpdate :: Text -> Route WebApp -> Route WebApp -> Int -> Int -> Int -> Widget
|
||||||
autoUpdate updating gethtml home ms_delay ms_startdelay = do
|
autoUpdate updating gethtml home ms_delay ms_startdelay ms_refreshdelay = do
|
||||||
{- Fallback refreshing is provided for non-javascript browsers. -}
|
{- Fallback refreshing is provided for non-javascript browsers. -}
|
||||||
let delayseconds = show $ ms_to_seconds ms_delay
|
let delayseconds = show $ ms_to_seconds ms_refreshdelay
|
||||||
toWidgetHead $(hamletFile $ hamletTemplate "metarefresh")
|
toWidgetHead $(hamletFile $ hamletTemplate "metarefresh")
|
||||||
|
|
||||||
{- Use long polling to update the status display. -}
|
{- Use long polling to update the status display. -}
|
||||||
|
@ -130,7 +130,7 @@ statusDisplay = do
|
||||||
|
|
||||||
nid <- liftIO $ notificationHandleToId <$>
|
nid <- liftIO $ notificationHandleToId <$>
|
||||||
(newNotificationHandle =<< getNotificationBroadcaster webapp)
|
(newNotificationHandle =<< getNotificationBroadcaster webapp)
|
||||||
autoUpdate updating (StatusR nid) HomeR (3000 :: Int) (40 :: Int)
|
autoUpdate updating (StatusR nid) HomeR (10 :: Int) (10 :: Int) (3000 :: Int)
|
||||||
|
|
||||||
getNotificationBroadcaster :: WebApp -> IO NotificationBroadcaster
|
getNotificationBroadcaster :: WebApp -> IO NotificationBroadcaster
|
||||||
getNotificationBroadcaster webapp = notificationBroadcaster
|
getNotificationBroadcaster webapp = notificationBroadcaster
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue