Last active
December 18, 2015 16:59
-
-
Save yogsototh/5815082 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Serve javascript | |
> newtype RepJavascript = RepJavascript Content | |
> instance ToTypedContent RepJavascript where | |
> toTypedContent (RepJavascript c) = TypedContent typeJavascript c | |
> instance HasContentType RepJavascript where | |
> getContentType _ = typeJavascript | |
> deriving instance ToContent RepJavascript | |
> deriving instance ToContent Javascript where | |
> toContent = toContent . renderJavascript | |
> | |
> juliusToRepJavascript j = do | |
> render <- getUrlRenderParams | |
> return $ toTypedContent $ RepJavascript (toContent $ j render) | |
> sendJavascriptFromAction :: Action -> Handler TypedContent | |
> sendJavascriptFromAction action = do | |
> juliusToRepJavascript $(juliusFile "templates/action.julius") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment