clean onInit

This commit is contained in:
Don 2022-10-24 20:05:43 +00:00
parent 5f532a765e
commit 754aa740d4
3 changed files with 7 additions and 22 deletions

View File

@ -2,14 +2,12 @@ import * as React from 'react';
import * as ReactDom from 'react-dom'; import * as ReactDom from 'react-dom';
import { Version } from '@microsoft/sp-core-library'; import { Version } from '@microsoft/sp-core-library';
import { BaseClientSideWebPart } from "@microsoft/sp-webpart-base"; import { BaseClientSideWebPart } from "@microsoft/sp-webpart-base";
import { IPropertyPaneConfiguration, PropertyPaneTextField } from "@microsoft/sp-property-pane"; import { IPropertyPaneConfiguration } from "@microsoft/sp-property-pane";
import * as strings from 'AddJsCssReferenceWebPartStrings'; import * as strings from 'AddJsCssReferenceWebPartStrings';
import AddJsCssReference from './components/AddJsCssReference'; import AddJsCssReference, { IAddJsCssReferenceProps } from './components/AddJsCssReference';
import { IAddJsCssReferenceProps } from './components/IAddJsCssReferenceProps';
import { getSP } from './pnpjsConfig'; import { getSP } from './pnpjsConfig';
export interface IAddJsCssReferenceWebPartProps { export interface IAddJsCssReferenceWebPartProps {
description: string;
} }
export default class AddJsCssReferenceWebPart extends BaseClientSideWebPart<IAddJsCssReferenceWebPartProps> { export default class AddJsCssReferenceWebPart extends BaseClientSideWebPart<IAddJsCssReferenceWebPartProps> {
@ -18,7 +16,6 @@ export default class AddJsCssReferenceWebPart extends BaseClientSideWebPart<IAdd
const element: React.ReactElement<IAddJsCssReferenceProps> = React.createElement( const element: React.ReactElement<IAddJsCssReferenceProps> = React.createElement(
AddJsCssReference, AddJsCssReference,
{ {
description: this.properties.description,
context: this.context context: this.context
} }
); );
@ -26,10 +23,9 @@ export default class AddJsCssReferenceWebPart extends BaseClientSideWebPart<IAdd
ReactDom.render(element, this.domElement); ReactDom.render(element, this.domElement);
} }
protected async onInit(): Promise<void> { protected onInit(): Promise<void> {
// eslint-disable-next-line @typescript-eslint/no-floating-promises
super.onInit();
getSP(this.context); getSP(this.context);
return super.onInit();
} }
protected onDispose(): void { protected onDispose(): void {
@ -45,16 +41,12 @@ export default class AddJsCssReferenceWebPart extends BaseClientSideWebPart<IAdd
pages: [ pages: [
{ {
header: { header: {
description: strings.PropertyPaneDescription description: ""
}, },
groups: [ groups: [
{ {
groupName: strings.BasicGroupName, groupName: "No properties available",
groupFields: [ groupFields: []
PropertyPaneTextField('description', {
label: strings.DescriptionFieldLabel
})
]
} }
] ]
} }

View File

@ -35,7 +35,6 @@ const theme: ITheme = createTheme({
const stackStyles: Partial<IStackStyles> = { root: { height: 30 } }; const stackStyles: Partial<IStackStyles> = { root: { height: 30 } };
export interface IAddJsCssReferenceProps { export interface IAddJsCssReferenceProps {
description: string;
context: WebPartContext; context: WebPartContext;
} }

View File

@ -1,6 +0,0 @@
import { WebPartContext } from "@microsoft/sp-webpart-base";
export interface IAddJsCssReferenceProps {
description: string;
context:WebPartContext;
}