@microsoft/sp-webpart-base
Version:
SharePoint Framework support for building web parts
87 lines • 3.08 kB
TypeScript
import type { IClientSideWebPartManifestInstance } from '@microsoft/sp-module-interfaces';
import type { HttpClient, SPHttpClient } from '@microsoft/sp-http';
import type { PageContext } from '@microsoft/sp-page-context';
import type { SPEvent, SPEventArgs } from '@microsoft/sp-core-library';
import type IClientSideWebPartStatusRenderer from './IClientSideWebPartStatusRenderer';
import type IWebPartHost from '../components/host/IWebPartHost';
import type { IPropertyPaneAccessor } from './context/IPropertyPaneAccessor';
/**
* The base context interface for client-side web parts.
*
* @remarks
* A "context" object is a collection of well-known services and other
* objects that are likely to be needed by any business logic working with
* a component. Each component type has its own specialized extension of
* this interface, e.g. IWebPartContext for web parts, IExtensionContext for
* client-side extensions, etc.
*
* @deprecated - This interface will be removed in an upcoming release. Use the
* {@link WebPartContext} class instead.
*
* @privateRemarks
*
* NOTE: The context object is a convenience that avoids the overhead of
* properly factoring the dependencies for each class in your project,
* in a situation where most classes have essentially the same dependencies.
* If lots of members are added to the context without displine, it can
* easily devolve into a poor engineering practice (where "everything depends
* on everything else"). Think carefully before adding more objects to this
* interface.
*
* Only add data properties or well-defined classes with ubiquitous applicability.
* Do not add loose functions, callbacks, or settable properties.
*
* @public
*/
interface IWebPartContext {
/**
* Manifest for the client-side web part.
*/
readonly manifest: IClientSideWebPartManifestInstance<any>;
/**
* Web part instance id. This is a globally unique value.
*/
readonly instanceId: string;
/**
* Web part tag to be used for logging and telemetry.
*/
readonly webPartTag: string;
/**
* Reference to the DOM element that hosts this client-side component.
*/
readonly domElement: HTMLElement;
/**
* HttpClient instance scoped to this web part.
*/
readonly httpClient: HttpClient;
/**
* SPHttpClient instance scoped to this web part.
*/
readonly spHttpClient: SPHttpClient;
/**
* SharePoint page context.
*/
readonly pageContext: PageContext;
/**
* Web part status renderer.
*/
readonly statusRenderer: IClientSideWebPartStatusRenderer;
/**
* Accessor for common web part property pane operations.
*/
readonly propertyPane: IPropertyPaneAccessor;
/**
* Web part host.
* @internal
*/
readonly host: IWebPartHost;
/**
* Web part data updated event.
*
* @eventproperty
* @internal
*/
readonly _dataUpdatedEvent: SPEvent<SPEventArgs>;
}
export default IWebPartContext;
//# sourceMappingURL=IWebPartContext.d.ts.map