@microsoft/sp-webpart-base
Version:
SharePoint Framework support for building web parts
44 lines • 1.92 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.TeamsAwareWebPartHost = void 0;
var tslib_1 = require("tslib");
var MinimalWebPartHost_1 = require("./MinimalWebPartHost");
var TeamsEnvironmentManager_1 = require("../../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) {
tslib_1.__extends(TeamsAwareWebPartHost, _super);
function TeamsAwareWebPartHost() {
return _super !== null && _super.apply(this, arguments) || this;
}
TeamsAwareWebPartHost.prototype.getAdditionalContextProperties = function () {
var microsoftTeams = TeamsEnvironmentManager_1.TeamsEnvironmentManager.getTeamsJs();
if (microsoftTeams) {
return {
microsoftTeams: {
teamsJs: microsoftTeams,
context: TeamsEnvironmentManager_1.TeamsEnvironmentManager.getTeamsContext()
}
};
}
else {
return {};
}
};
TeamsAwareWebPartHost.prototype.getAdditionalContextPropertiesAsync = function () {
return TeamsEnvironmentManager_1.TeamsEnvironmentManager.getTeamsSDK();
};
TeamsAwareWebPartHost.prototype.onBeforeWebPartInitialize = function (options) {
return _super.prototype.onBeforeWebPartInitialize.call(this, options).then(function () {
return TeamsEnvironmentManager_1.TeamsEnvironmentManager.initialize();
});
};
return TeamsAwareWebPartHost;
}(MinimalWebPartHost_1.MinimalWebPartHost));
exports.TeamsAwareWebPartHost = TeamsAwareWebPartHost;
//# sourceMappingURL=TeamsAwareWebPartHost.js.map