Add sandbox template constructor.

This commit is contained in:
Dillon Kearns 2020-09-13 21:05:32 -07:00
parent 55f2a4bcd4
commit 59a7402809

View File

@ -8,6 +8,30 @@ import Pages.StaticHttp as StaticHttp
import Shared
sandbox :
{ view :
templateMetadata
-> PagePath Pages.PathKey
-> Shared.RenderedBody
-> Shared.PageView Never
, head :
templateMetadata
-> PagePath Pages.PathKey
-> List (Head.Tag Pages.PathKey)
}
-> TemplateSandbox templateMetadata
sandbox config =
template
{ view =
\dynamicPayload allMetadata staticPayload rendered ->
config.view staticPayload.metadata staticPayload.path rendered
, head = \staticPayload -> config.head staticPayload.metadata staticPayload.path
, staticData = \_ -> StaticHttp.succeed ()
, init = \_ -> ( (), Cmd.none )
, update = \_ _ _ -> ( (), Cmd.none, Shared.NoOp )
}
simplest :
{ view :
List ( PagePath Pages.PathKey, GlobalMetadata.Metadata )
@ -127,6 +151,10 @@ type alias Template templateMetadata templateStaticData templateModel templateMs
}
type alias TemplateSandbox templateMetadata =
Template templateMetadata () () Never
type alias StaticPayload metadata staticData =
{ static : staticData
, sharedStatic : Shared.StaticData