Skip to content
This repository has been archived by the owner on Oct 23, 2021. It is now read-only.

sp core library.servicekey.createcustom

John Nguyen edited this page Apr 22, 2021 · 2 revisions

Home > @microsoft/sp-core-library > ServiceKey > createCustom

ServiceKey.createCustom() method

Constructs a new ServiceKey whose default implementation will be obtained by invoking the specified callback.

Signature:

static createCustom<TKey>(name: string, defaultCreator: ServiceCreator<TKey>): ServiceKey<TKey>;

Parameters

Parameter Type Description
name string A name such as "my-package.IMyService" which should be unique across packages.
defaultCreator ServiceCreator<TKey> a callback that returns an object that implements the T interface

Returns:

ServiceKey<TKey>

the newly created service key

Clone this wiki locally