sp core library.servicescope.createdefaultandprovide - microsoft/Viva-Connections-Extensibility-Beta GitHub Wiki

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

⚠️ **GitHub.com Fallback** ⚠️