happstack-jmacro-7.0.12.6: Support for using JMacro with Happstack

Safe Haskell | None
Language | Haskell2010

Happstack.Server.JMacro

Contents

- Orphan instances

Description

This modules provides support for using JMacro with Happstack.

It provides the instance,

    instance ToMessage JStat

Which will serve a `JStat` value as `text/javascript; charset=UTF-8`. The rendered JavaScript will be wrapped in an anonymous function that is then called, so as to ensure the statements execute in a local scope. An implication of this is that top-level unhygienic variables in JMacro will not be globally available; instead, you should set properties on the global `window` object.

Synopsis

- jmResponse :: ServerMonad m => JStat -> m Response

# Documentation

jmResponse :: ServerMonad m => JStat -> m Response Source #

Render a `JStat` into a `Response`, saturating the variable names with a hash computed from the `rqUri`. Unlike the `ToMessage` instance for `JStat`, this doesn't wrap the statements in a function and so the workaround for global unhygienic names isn't necessary. On the other hand, generated variable names are a bit longer.

# Orphan instances

ToMessage JStat Source # |
Instance details Methods toContentType :: JStat -> ByteString Source # toMessage :: JStat -> ByteString Source # toResponse :: JStat -> Response Source #