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

sp core library.servicescope.createdefaultandprovide

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

Home > @microsoft/sp-core-library > ServiceScope > createDefaultAndProvide

ServiceScope.createDefaultAndProvide() method

This is a shorthand function that constructs the default implementation of the specified serviceKey, and then registers it by calling ServiceScope.provide().

Signature:

createDefaultAndProvide<T>(serviceKey: ServiceKey<T>): T;

Parameters

Parameter Type Description
serviceKey ServiceKey<T> the key that can be used later to consume the service

Returns:

T

a service instance that was constructed using ServiceKey.defaultCreator

Clone this wiki locally