no longer need webapp state storage! excellent
This commit is contained in:
parent
8ca2aa1cba
commit
9cf4701a8f
3 changed files with 0 additions and 21 deletions
|
@ -17,25 +17,11 @@ import Utility.Yesod
|
|||
|
||||
import Yesod
|
||||
import Data.Text (Text)
|
||||
import Control.Concurrent.STM
|
||||
import Control.Concurrent
|
||||
|
||||
inFirstRun :: Handler Bool
|
||||
inFirstRun = isNothing . relDir <$> getYesod
|
||||
|
||||
newWebAppState :: IO (TMVar WebAppState)
|
||||
newWebAppState = atomically $ newTMVar $ WebAppState { showIntro = True }
|
||||
|
||||
getWebAppState :: forall sub. GHandler sub WebApp WebAppState
|
||||
getWebAppState = liftIO . atomically . readTMVar =<< webAppState <$> getYesod
|
||||
|
||||
modifyWebAppState :: forall sub. (WebAppState -> WebAppState) -> GHandler sub WebApp ()
|
||||
modifyWebAppState a = go =<< webAppState <$> getYesod
|
||||
where
|
||||
go s = liftIO $ atomically $ do
|
||||
v <- takeTMVar s
|
||||
putTMVar s $ a v
|
||||
|
||||
{- Runs an Annex action from the webapp.
|
||||
-
|
||||
- When the webapp is run outside a git-annex repository, the fallback
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue