sp core library.servicekey.create - microsoft/Viva-Connections-Extensibility-Beta GitHub Wiki
Home > @microsoft/sp-core-library > ServiceKey > create
Constructs a new ServiceKey whose default implementation will be a new instance of a TypeScript class that accepts the standard constructor parameter.
Signature:
static create<TKey>(name: string, serviceClass: {
new (serviceScope: ServiceScope): TKey;
}): ServiceKey<TKey>;| Parameter | Type | Description |
|---|---|---|
| name | string | A name such as "my-package.IMyService" which should be unique across packages. |
| serviceClass | { new (serviceScope: ServiceScope): TKey; } | the TypeScript class that implements the service. |
Returns:
ServiceKey<TKey>
the newly created ServiceKey
If you want to specify custom constructor parameters, use ServiceKey.createCustom() instead.