in src/classic/createBootstrapper.js [22:79]
constructor(spec, callback) {
super();
// Check if a container spec was supplied
if (!spec.container) {
console.warn('"Container" property was not supplied');
return;
}
// Set the component selector if defined
if (spec.componentSelector) {
this.componentSelector = spec.componentSelector;
}
// Set the watcher value if defined
if (typeof spec.enableWatcher === 'boolean') {
this.enableWatcher = spec.enableWatcher;
}
// Create a new container
const containerBuilder = new ContainerBuilder(spec.defaultOptions || null);
// Map the components
for (let i = 0; i < spec.container.length; i++) {
let registration;
if (spec.container[i].forAsync) {
registration = containerBuilder
.registerAsync(spec.container[i].forAsync)
.as(spec.container[i].register);
} else {
registration = containerBuilder
.register(spec.container[i].for)
.as(spec.container[i].register);
}
if (spec.container[i].withDefaultProps) {
registration.withDefaultProps(spec.container[i].withDefaultProps);
}
if (spec.container[i].withOptions) {
registration.withOptions(spec.container[i].withOptions);
}
}
this._shouldUpdateProxy = spec.shouldUpdate || null;
this._willUpdateProxy = spec.willUpdate || null;
this._didUpdateProxy = spec.didUpdate || null;
this._willUnmountProxy = spec.willUnmountHabitats || null;
this._didUnmountProxy = spec.didUnmountHabitats || null;
this._didDisposeProxy = spec.didDispose || null;
// Finally, set the container
this.setContainer(containerBuilder.build(), () => {
if (typeof callback === 'function') {
callback();
}
});
}