parent
9a0a028d63
commit
1083b41a90
|
@ -11,10 +11,8 @@ const debug = D('@flecks/react/client');
|
|||
export {FlecksContext};
|
||||
|
||||
export const hooks = {
|
||||
'@flecks/web/client.up': async (flecks) => {
|
||||
'@flecks/web/client.up': async (container, flecks) => {
|
||||
const {ssr} = flecks.get('@flecks/react');
|
||||
const {appMountId} = flecks.get('@flecks/web');
|
||||
const container = window.document.getElementById(appMountId);
|
||||
debug('%sing...', ssr ? 'hydrat' : 'render');
|
||||
const RootComponent = React.createElement(
|
||||
React.StrictMode,
|
||||
|
|
|
@ -5,7 +5,7 @@ import localStorageEnhancer from './local-storage';
|
|||
|
||||
export const hooks = {
|
||||
'@flecks/web/client.up': Flecks.priority(
|
||||
async (flecks) => {
|
||||
async (container, flecks) => {
|
||||
const slices = await flecks.invokeMergeUniqueAsync('@flecks/redux.slices');
|
||||
const reducer = await createReducer(flecks, slices);
|
||||
// Hydrate from server.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import SocketClient from './socket';
|
||||
|
||||
export const hooks = {
|
||||
'@flecks/web/client.up': async (flecks) => {
|
||||
'@flecks/web/client.up': async (container, flecks) => {
|
||||
const socket = new SocketClient(flecks);
|
||||
flecks.socket.client = socket;
|
||||
await socket.connect();
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
export const hooks = {
|
||||
/**
|
||||
* Define sequential actions to run when the client comes up.
|
||||
*
|
||||
* @param {Element} container The root DOM element of the application.
|
||||
*
|
||||
* @invoke SequentialAsync
|
||||
*/
|
||||
'@flecks/web/client.up': async () => {
|
||||
'@flecks/web/client.up': async (container) => {
|
||||
await youCanDoAsyncThingsHere();
|
||||
},
|
||||
/**
|
||||
|
|
|
@ -56,8 +56,10 @@ const {version} = require('@flecks/web/package.json');
|
|||
try {
|
||||
const flecks = await Flecks.from(runtime);
|
||||
window.flecks = flecks;
|
||||
await flecks.invokeSequentialAsync('@flecks/web/client.up');
|
||||
const appMountContainerId = `#${config['@flecks/web'].appMountId}-container`;
|
||||
const containerId = `#${config['@flecks/web'].appMountId}`;
|
||||
const container = window.document.querySelector(containerId);
|
||||
await flecks.invokeSequentialAsync('@flecks/web/client.up', container);
|
||||
const appMountContainerId = `${containerId}-container`;
|
||||
window.document.querySelector(appMountContainerId).style.display = 'block';
|
||||
debug('up!');
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user