UNPKG

@microsoft/sp-webpart-base

Version:

SharePoint Framework support for building web parts

41 lines 1.65 kB
import { __extends } from "tslib"; import { MinimalWebPartHost } from './MinimalWebPartHost'; import { TeamsEnvironmentManager } from '../../core/teams/TeamsEnvironmentManager'; /** * A webpart host that is Teams Aware. * Can be used in cases SP-Page needs to be hosted inside of teams. * Webparts in such a page can make use of teams information and be aware that they are hosted inside of teams. * * @internal */ var TeamsAwareWebPartHost = /** @class */ (function (_super) { __extends(TeamsAwareWebPartHost, _super); function TeamsAwareWebPartHost() { return _super !== null && _super.apply(this, arguments) || this; } TeamsAwareWebPartHost.prototype.getAdditionalContextProperties = function () { var microsoftTeams = TeamsEnvironmentManager.getTeamsJs(); if (microsoftTeams) { return { microsoftTeams: { teamsJs: microsoftTeams, context: TeamsEnvironmentManager.getTeamsContext() } }; } else { return {}; } }; TeamsAwareWebPartHost.prototype.getAdditionalContextPropertiesAsync = function () { return TeamsEnvironmentManager.getTeamsSDK(); }; TeamsAwareWebPartHost.prototype.onBeforeWebPartInitialize = function (options) { return _super.prototype.onBeforeWebPartInitialize.call(this, options).then(function () { return TeamsEnvironmentManager.initialize(); }); }; return TeamsAwareWebPartHost; }(MinimalWebPartHost)); export { TeamsAwareWebPartHost }; //# sourceMappingURL=TeamsAwareWebPartHost.js.map