in lib/classic/createBootstrapper.js [38:147]
var _Mixin = exports._Mixin = function (_Bootstrapper) {
_inherits(_Mixin, _Bootstrapper);
/*
* A Constructor that takes a spec
*/
function _Mixin(spec, callback) {
_classCallCheck(this, _Mixin);
// Check if a container spec was supplied
var _this = _possibleConstructorReturn(this, (_Mixin.__proto__ || Object.getPrototypeOf(_Mixin)).call(this));
if (!spec.container) {
console.warn('"Container" property was not supplied');
return _possibleConstructorReturn(_this);
}
// 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
var containerBuilder = new _ContainerBuilder2.default(spec.defaultOptions || null);
// Map the components
for (var i = 0; i < spec.container.length; i++) {
var registration = void 0;
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(), function () {
if (typeof callback === 'function') {
callback();
}
});
return _this;
}
_createClass(_Mixin, [{
key: 'shouldUpdate',
value: function shouldUpdate(node) {
if (this._shouldUpdateProxy) {
this._shouldUpdateProxy(node);
}
}
}, {
key: 'willUpdate',
value: function willUpdate() {
if (this._willUpdateProxy) {
this._willUpdateProxy();
}
}
}, {
key: 'didUpdate',
value: function didUpdate() {
if (this._didUpdateProxy) {
this._didUpdateProxy();
}
}
}, {
key: 'willUnmountHabitats',
value: function willUnmountHabitats() {
if (this._willUnmountProxy) {
this._willUnmountProxy();
}
}
}, {
key: 'didUnmountHabitats',
value: function didUnmountHabitats() {
if (this._didUnmountProxy) {
this._didUnmountProxy();
}
}
}, {
key: 'didDispose',
value: function didDispose() {
if (this._didDisposeProxy) {
this._didDisposeProxy();
}
}
}]);
return _Mixin;
}(_Bootstrapper3.default);