UNPKG

@microsoft/sp-webpart-base

Version:

SharePoint Framework support for building web parts

53 lines 2.15 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.IBaseIframedWebPart = exports.IFRAMED_WEB_PART = void 0; var sp_component_base_1 = require("@microsoft/sp-component-base"); // enum identifier for IframedWebPart type // eslint-disable-next-line @typescript-eslint/typedef exports.IFRAMED_WEB_PART = { webPart: 'webpart', isolatedACEWebPart: 'isolatedACEWebPart' }; var IBaseIframedWebPart = /** @class */ (function () { function IBaseIframedWebPart(controller, serviceScope, metadata) { this._controller = controller; this.origin = metadata.origin; this.url = metadata.url; this.webPartData = metadata.webPartData; this.webPartElementId = metadata.webPartElementId; this.displayMode = metadata.displayMode; this.addedFromPersistedData = metadata.addedFromPersistedData; this.theme = metadata.theme; this.instanceId = metadata.webPartData.instanceId; this.isDisposed = false; this._themeProvider = serviceScope.consume(sp_component_base_1.ThemeProvider.serviceKey); this._onThemeChanged.bind(this); this._themeProvider.themeChangedEvent.add(this, this._onThemeChanged); } Object.defineProperty(IBaseIframedWebPart.prototype, "componentId", { get: function () { return this.webPartElementId; }, enumerable: false, configurable: true }); IBaseIframedWebPart.prototype.dispose = function () { this._themeProvider.themeChangedEvent.remove(this, this._onThemeChanged); this.isDisposed = true; }; Object.defineProperty(IBaseIframedWebPart.prototype, "type", { get: function () { return this._type; }, enumerable: false, configurable: true }); IBaseIframedWebPart.prototype._onThemeChanged = function (eventArgs) { if (eventArgs.theme) { this._controller.setTheme(eventArgs.theme, this.instanceId); } }; return IBaseIframedWebPart; }()); exports.IBaseIframedWebPart = IBaseIframedWebPart; //# sourceMappingURL=IBaseIframedWebPart.js.map