mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2024-11-28 06:05:31 +03:00
Delete obsolete code (superceded by fetchRouteData).
This commit is contained in:
parent
1667e84e97
commit
d59c57ac01
@ -1,5 +1,5 @@
|
|||||||
function elmPagesUiFile() {
|
function elmPagesUiFile() {
|
||||||
return `port module Pages exposing (builtAt, reloadData)
|
return `port module Pages exposing (builtAt)
|
||||||
|
|
||||||
import Time
|
import Time
|
||||||
import Json.Decode
|
import Json.Decode
|
||||||
@ -9,19 +9,6 @@ import Json.Encode
|
|||||||
builtAt : Time.Posix
|
builtAt : Time.Posix
|
||||||
builtAt =
|
builtAt =
|
||||||
Time.millisToPosix ${Math.round(global.builtAt.getTime())}
|
Time.millisToPosix ${Math.round(global.builtAt.getTime())}
|
||||||
|
|
||||||
|
|
||||||
reloadData : { body : ( String, String ) } -> Cmd msg
|
|
||||||
reloadData options =
|
|
||||||
elmPagesReloadData
|
|
||||||
(Json.Encode.object
|
|
||||||
[ ( "content-type", options.body |> Tuple.first |> Json.Encode.string )
|
|
||||||
, ( "body", options.body |> Tuple.second |> Json.Encode.string )
|
|
||||||
]
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
port elmPagesReloadData : Json.Decode.Value -> Cmd msg
|
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,12 +27,6 @@ function loadContentAndInitializeApp() {
|
|||||||
loadNamedAnchor();
|
loadNamedAnchor();
|
||||||
});
|
});
|
||||||
|
|
||||||
app.ports.elmPagesReloadData &&
|
|
||||||
app.ports.elmPagesReloadData.subscribe((data) => {
|
|
||||||
console.log("RELOAD DATA PORT!");
|
|
||||||
app.ports.fromJsPort.send({ tag: "Reload", data });
|
|
||||||
});
|
|
||||||
|
|
||||||
return app;
|
return app;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -272,7 +272,6 @@ type Msg userMsg pageData sharedData errorPage
|
|||||||
| UpdateCacheAndUrlNew Bool Url (Maybe userMsg) (Result Http.Error ( Url, ResponseSketch pageData sharedData ))
|
| UpdateCacheAndUrlNew Bool Url (Maybe userMsg) (Result Http.Error ( Url, ResponseSketch pageData sharedData ))
|
||||||
| PageScrollComplete
|
| PageScrollComplete
|
||||||
| HotReloadCompleteNew Bytes
|
| HotReloadCompleteNew Bytes
|
||||||
| ReloadCurrentPageData RequestInfo
|
|
||||||
|
|
||||||
|
|
||||||
{-| -}
|
{-| -}
|
||||||
@ -396,11 +395,6 @@ update config appMsg model =
|
|||||||
, FetchPageData Nothing url (UpdateCacheAndUrlNew False url Nothing)
|
, FetchPageData Nothing url (UpdateCacheAndUrlNew False url Nothing)
|
||||||
)
|
)
|
||||||
|
|
||||||
ReloadCurrentPageData requestInfo ->
|
|
||||||
( model
|
|
||||||
, FetchPageData (Just requestInfo) model.url (UpdateCacheAndUrlNew False model.url Nothing)
|
|
||||||
)
|
|
||||||
|
|
||||||
UserMsg userMsg ->
|
UserMsg userMsg ->
|
||||||
case model.pageData of
|
case model.pageData of
|
||||||
Ok pageData ->
|
Ok pageData ->
|
||||||
@ -670,16 +664,6 @@ application config =
|
|||||||
(urls.currentUrl |> config.urlToRoute |> config.routeToPath |> Path.join)
|
(urls.currentUrl |> config.urlToRoute |> config.routeToPath |> Path.join)
|
||||||
pageData.userModel
|
pageData.userModel
|
||||||
|> Sub.map UserMsg
|
|> Sub.map UserMsg
|
||||||
, config.fromJsPort
|
|
||||||
|> Sub.map
|
|
||||||
(\value ->
|
|
||||||
case value |> Decode.decodeValue fromJsPortDecoder of
|
|
||||||
Ok requestInfo ->
|
|
||||||
ReloadCurrentPageData requestInfo
|
|
||||||
|
|
||||||
Err _ ->
|
|
||||||
PageScrollComplete
|
|
||||||
)
|
|
||||||
, config.hotReloadData
|
, config.hotReloadData
|
||||||
|> Sub.map HotReloadCompleteNew
|
|> Sub.map HotReloadCompleteNew
|
||||||
]
|
]
|
||||||
@ -725,24 +709,6 @@ withUserMsg config userMsg ( model, effect ) =
|
|||||||
( model, effect )
|
( model, effect )
|
||||||
|
|
||||||
|
|
||||||
fromJsPortDecoder : Decode.Decoder RequestInfo
|
|
||||||
fromJsPortDecoder =
|
|
||||||
Decode.field "tag" Decode.string
|
|
||||||
|> Decode.andThen
|
|
||||||
(\tag ->
|
|
||||||
case tag of
|
|
||||||
"Reload" ->
|
|
||||||
Decode.field "data"
|
|
||||||
(Decode.map2 RequestInfo
|
|
||||||
(Decode.field "content-type" Decode.string)
|
|
||||||
(Decode.field "body" Decode.string)
|
|
||||||
)
|
|
||||||
|
|
||||||
_ ->
|
|
||||||
Decode.fail <| "Unexpected tag " ++ tag
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
urlPathToPath : Url -> Path
|
urlPathToPath : Url -> Path
|
||||||
urlPathToPath urls =
|
urlPathToPath urls =
|
||||||
urls.path |> Path.fromString
|
urls.path |> Path.fromString
|
||||||
|
Loading…
Reference in New Issue
Block a user