office-ui-fabric-react
Version:
Reusable React components for building experiences for Microsoft 365.
38 lines • 1.69 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var React = require("react");
var Utilities_1 = require("../../Utilities");
var Layer_notification_1 = require("./Layer.notification");
var LayerHost = /** @class */ (function (_super) {
tslib_1.__extends(LayerHost, _super);
function LayerHost(props) {
var _this = _super.call(this, props) || this;
var layerHostId = Utilities_1.getId();
var _a = _this.props.id, hostId = _a === void 0 ? layerHostId : _a;
_this.hostId = hostId;
_this.rootRef = React.createRef();
Utilities_1.initializeComponentRef(_this);
return _this;
}
LayerHost.prototype.notifyLayersChanged = function () {
// Nothing, since the default implementation of Layer Host does not need to react to layer changes.
};
LayerHost.prototype.shouldComponentUpdate = function () {
return false;
};
LayerHost.prototype.componentDidMount = function () {
Layer_notification_1.registerLayerHost(this.hostId, this);
Layer_notification_1.notifyHostChanged(this.props.id);
};
LayerHost.prototype.componentWillUnmount = function () {
Layer_notification_1.unregisterLayerHost(this.hostId, this);
Layer_notification_1.notifyHostChanged(this.props.id);
};
LayerHost.prototype.render = function () {
return React.createElement("div", tslib_1.__assign({}, this.props, { className: Utilities_1.css('ms-LayerHost', this.props.className), ref: this.rootRef }));
};
return LayerHost;
}(React.Component));
exports.LayerHost = LayerHost;
//# sourceMappingURL=LayerHost.js.map
;