WebPartContext class
Web part context object. This object contains the contextual services available to a web part. e.g. a contextual instance to the http client.
- Extends
Remarks
The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the WebPartContext
class.
Properties
dom |
Reference to the DOM element that hosts this client-side component. |
microsoft |
Contextual information about the current Microsoft Teams tab. This object will only be defined if a component is being hosted in Microsoft Teams. |
sdks | Conditional set of SDKs provided by SPFx dependent on the environment. |
status |
Web part status renderer. |
width |
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. |
Property Details
domElement
Reference to the DOM element that hosts this client-side component.
get domElement(): HTMLElement;
Property Value
HTMLElement
microsoftTeams
Warning
This API is now deprecated.
- This function has been deprecated
Contextual information about the current Microsoft Teams tab. This object will only be defined if a component is being hosted in Microsoft Teams.
get microsoftTeams(): typeof microsoftTeams | undefined;
Property Value
typeof @microsoft/sp-webpart-base!~microsoftTeams | undefined
Remarks
For more information, please see: https://docs.microsoft.com/en-us/javascript/api/@microsoft/teams-js/?view=msteams-client-js-latest
sdks
Conditional set of SDKs provided by SPFx dependent on the environment.
get sdks(): ISDKs;
Property Value
statusRenderer
Web part status renderer.
get statusRenderer(): IClientSideWebPartStatusRenderer;
Property Value
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 widthCacheKey(): string | undefined;
Property Value
string | undefined