1
1
mirror of https://github.com/aelve/guide.git synced 2024-11-23 04:07:14 +03:00
guide/front-ps/client/shared.js
Jens Krause 2968979823
Add endpoint categories + read state (#202)
+ handle data
+ view data
+ read state on client side
2017-09-07 22:09:32 +02:00

18 lines
514 B
JavaScript

// common shared js
import '../common/shared.js';
// polyfills
require('es6-promise').polyfill();
export const initClient = function (client) {
// window.__puxInitialState is the JSON serialized state injected after
// rendering on the server (src/Server.purs).
const initialState = client.readState(window.__puxInitialState);
const app = client.main(window.location.pathname)(window.__puxLastState || initialState)();
app.state.subscribe(function (state) {
window.__puxLastState = state;
});
}