@pnp/spfx-controls-react
Version:
Reusable React controls for SharePoint Framework solutions
42 lines • 2.17 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var React = tslib_1.__importStar(require("react"));
var ReactDom = tslib_1.__importStar(require("react-dom"));
var sp_core_library_1 = require("@microsoft/sp-core-library");
var sp_application_base_1 = require("@microsoft/sp-application-base");
var TestApp_1 = tslib_1.__importDefault(require("./TestApp"));
var LOG_SOURCE = 'TestApplicationCustomizer';
/** A Custom Action which can be run during execution of a Client Side Application */
var TestApplicationCustomizer = /** @class */ (function (_super) {
tslib_1.__extends(TestApplicationCustomizer, _super);
function TestApplicationCustomizer() {
return _super !== null && _super.apply(this, arguments) || this;
}
TestApplicationCustomizer.prototype.onInit = function () {
sp_core_library_1.Log.info(LOG_SOURCE, "Initialized TestApplicationCustomizer");
this.context.placeholderProvider.changedEvent.add(this, this._renderPlaceHolders);
return Promise.resolve();
};
TestApplicationCustomizer.prototype._renderPlaceHolders = function () {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var element;
return tslib_1.__generator(this, function (_a) {
if (!this._topPlaceHolder) {
this._topPlaceHolder = this.context.placeholderProvider.tryCreateContent(sp_application_base_1.PlaceholderName.Top, { onDispose: this._onDispose });
}
element = React.createElement(TestApp_1.default, {
context: this.context
});
ReactDom.render(element, this._topPlaceHolder.domElement);
return [2 /*return*/];
});
});
};
TestApplicationCustomizer.prototype._onDispose = function (PlaceholderContent) {
ReactDom.unmountComponentAtNode(PlaceholderContent.domElement);
};
return TestApplicationCustomizer;
}(sp_application_base_1.BaseApplicationCustomizer));
exports.default = TestApplicationCustomizer;
//# sourceMappingURL=TestApplicationCustomizer.js.map