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

sp core library.servicekey.id

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

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

ServiceKey.id property

A unique identifier for this service key.

Signature:

readonly id: string;

Remarks

This identifier is an automatically generated string that will be unique for the lifetime of the page. Callers should not make assumptions about the formatting of this string. It is currently based on a global counter, but this may change in the future.

The ServiceScope uses this identifier internally as a dictionary key for finding services. The ServiceKey is meant to be unique, even if multiple instances of the same library are loaded on the same page, even if the same name was passed to ServiceKey.create(). This is because each call to ServiceKey.create() could potentially provide a different defaultCreator implementation, whereas one of the design goals of ServiceScope is that the order in which libraries are loaded should never affect the resulting tree of scopes.

Clone this wiki locally