mirror of
https://github.com/aelve/guide.git
synced 2024-12-24 21:35:06 +03:00
parent
72d53a7ce0
commit
ac6ad91d34
@ -1,9 +1,5 @@
|
||||
// shared js
|
||||
import '../../shared.js';
|
||||
// client app
|
||||
var Client = require('./CategoryDetail.purs');
|
||||
const app = Client.main(window.location.pathname)(window.__puxLastState || Client.initialState)()
|
||||
|
||||
app.state.subscribe(function (state) {
|
||||
window.__puxLastState = state;
|
||||
});
|
||||
// shared js sources on client side
|
||||
import { initClient } from '../../shared.js';
|
||||
// init client app
|
||||
const client = require('./CategoryDetail.purs')
|
||||
initClient(client);
|
||||
|
@ -7,11 +7,14 @@ import Control.Monad.Eff.Console (CONSOLE, log)
|
||||
import DOM (DOM)
|
||||
import DOM.HTML (window)
|
||||
import DOM.HTML.Types (HISTORY)
|
||||
import Guide.Common.Types (AppEffects)
|
||||
import Data.Either (either)
|
||||
import Data.Foreign (Foreign)
|
||||
import Guide.CategoryDetail.Events (Event(..), foldp)
|
||||
import Guide.CategoryDetail.Routes (match)
|
||||
import Guide.CategoryDetail.State (State, init)
|
||||
import Guide.CategoryDetail.View.Layout (view)
|
||||
import Guide.Common.Api (decodeJson)
|
||||
import Guide.Common.Types (AppEffects)
|
||||
import Pux (CoreEffects, App, start)
|
||||
import Pux.DOM.Events (DOMEvent)
|
||||
import Pux.DOM.History (sampleURL)
|
||||
@ -35,5 +38,6 @@ main url state = do
|
||||
log "Heeeelloooo, here is category-detail page rendered on client-side"
|
||||
pure app
|
||||
|
||||
initialState :: State
|
||||
initialState = init "/"
|
||||
-- | Used to serialize State from JSON in *-.entry.js
|
||||
readState :: Foreign -> State
|
||||
readState json = either (\_ -> init "/") id (decodeJson json)
|
||||
|
Loading…
Reference in New Issue
Block a user