@microsoft/sp-webpart-base
Version:
SharePoint Framework support for building web parts
50 lines • 1.97 kB
JavaScript
import { ThemeProvider } from '@microsoft/sp-component-base';
// enum identifier for IframedWebPart type
// eslint-disable-next-line @typescript-eslint/typedef
export var 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(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;
}());
export { IBaseIframedWebPart };
//# sourceMappingURL=IBaseIframedWebPart.js.map