-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathManifest.js
48 lines (37 loc) · 1.35 KB
/
Manifest.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// import "babel-polyfill";
import ReactHabitat from "react-habitat";
import configureStore from "./store/configureStore";
import reducer from "./reducers/sltReducers";
import { ReduxDomFactory } from "react-habitat-redux";
const store = configureStore();
class Manifest extends ReactHabitat.Bootstrapper {
constructor() {
super();
// Create a new container:
const containerBuilder = new ReactHabitat.ContainerBuilder();
// Set the container to use the React Habitat Redux factory:
containerBuilder.factory = new ReduxDomFactory(store);
// Register our components that we want to expose to the DOM:
containerBuilder
.registerAsync(() => import("./components/Button/Button"))
.as("Button");
containerBuilder
.registerAsync(() => import("./components/Card/Card"))
.as("Card");
// Register our containers that we want to expose to the DOM:
containerBuilder
.registerAsync(() => import("./containers/Cart/Cart"))
.as("Cart");
containerBuilder
.registerAsync(() => import("./containers/ProductCard/ProductCard"))
.as("ProductCard");
// Set the DOM container:
this.setContainer(containerBuilder.build());
// Allow legacy components to be built as 'one-offs':
window.updateHabitat = this.update.bind(this);
// ^ To use this, do:
// window.updateHabitat();
}
}
// Export single instance:
export default new Manifest();