UNPKG

@microsoft/sp-webpart-base

Version:

SharePoint Framework support for building web parts

114 lines 4.08 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var tslib_1 = require("tslib"); var sp_core_library_1 = require("@microsoft/sp-core-library"); var BaseWebPartContext_1 = tslib_1.__importDefault(require("./BaseWebPartContext")); /** * Web part context object. This object contains the contextual services available to a web part. e.g. * a contextual instance to the http client. * * @public */ var WebPartContext = /** @class */ (function (_super) { tslib_1.__extends(WebPartContext, _super); /** @internal */ function WebPartContext(parameters) { var _this = _super.call(this, parameters) || this; sp_core_library_1.Validate.isNotNullOrUndefined(parameters.domElement, "webpart context domElement"); sp_core_library_1.Validate.isNotNullOrUndefined(parameters.statusRenderer, 'webpart context statusRenderer'); _this._domElement = parameters.domElement; _this._statusRenderer = parameters.statusRenderer; _this._pageLayoutType = parameters.pageLayoutType; // Assert the type to ignore the missing const enums in our internal teamsJs namespace _this._teams = parameters.microsoftTeams; _this._sdks = parameters.sdks; _this._widthCacheKey = parameters.widthCacheKey; _this._sdksAsync = parameters.sdksAsync; _this._getPositionOnPage = parameters.getPositionOnPage; return _this; } Object.defineProperty(WebPartContext.prototype, "domElement", { /** * Reference to the DOM element that hosts this client-side component. */ get: function () { return this._domElement; }, enumerable: false, configurable: true }); Object.defineProperty(WebPartContext.prototype, "sdks", { /** * {@inheritdoc ISDKs} */ get: function () { return this._sdks; }, enumerable: false, configurable: true }); /** * @internal * {@inheritdoc ISDKs} */ WebPartContext.prototype._getSdksAsync = function () { return this._sdksAsync; }; Object.defineProperty(WebPartContext.prototype, "statusRenderer", { /** * Web part status renderer. */ get: function () { return this._statusRenderer; }, enumerable: false, configurable: true }); Object.defineProperty(WebPartContext.prototype, "microsoftTeams", { /** * Contextual information about the current Microsoft Teams tab. This object will only be defined if * a component is being hosted in Microsoft Teams. * * @remarks * For more information, please see: * {@link https://docs.microsoft.com/en-us/javascript/api/@microsoft/teams-js/?view=msteams-client-js-latest} * @public * @deprecated - This function has been deprecated */ get: function () { return this._teams; }, enumerable: false, configurable: true }); Object.defineProperty(WebPartContext.prototype, "widthCacheKey", { /** * This functions returns a key generated by web parts display mode, layout index, and section factor. * It will return undefined if sectionFactor or display mode is undefined, else return the cache key. */ get: function () { return this._widthCacheKey; }, enumerable: false, configurable: true }); /** * Type of layout on which the web part is being rendered. * * @internal */ WebPartContext.prototype._getPageLayoutType = function () { return this._pageLayoutType; }; /** * @deprecated - This function has been deprecated * * @internal */ WebPartContext.prototype._setTeams = function (teams) { this._teams = teams; }; return WebPartContext; }(BaseWebPartContext_1.default)); exports.default = WebPartContext; //# sourceMappingURL=WebPartContext.js.map