Menu

Important: This documentation is about an older version. It's relevant only to the release noted, many of the features and functions have been updated or replaced. Please view the current version.

Enterprise Open source

Registry class

Signature

typescript
export declare class Registry<T extends RegistryItem> 

Import

typescript
import { Registry } from '@grafana/data';

Constructors

ConstructorModifiersDescription
constructor(init)Constructs a new instance of the Registry class

Properties

PropertyModifiersTypeDescription
setInit(init: () => T[]) => void

Methods

MethodModifiersDescription
get(id)
getIfExists(id)
isEmpty()
list(ids)Return a list of values by ID, or all values if not specified
register(ext)
selectOptions(current, filter)

constructor(init)

Constructs a new instance of the Registry class

Signature

typescript
constructor(init?: (() => T[]) | undefined);

Parameters

ParameterTypeDescription
init(() => T[]) | undefined

setInit property

Signature

typescript
setInit: (init: () => T[]) => void;

get method

Signature

typescript
get(id: string): T;

Parameters

ParameterTypeDescription
idstring

Returns:

T

getIfExists method

Signature

typescript
getIfExists(id: string | undefined): T | undefined;

Parameters

ParameterTypeDescription
idstring | undefined

Returns:

T | undefined

isEmpty method

Signature

typescript
isEmpty(): boolean;

Returns:

boolean

list method

Return a list of values by ID, or all values if not specified

Signature

typescript
list(ids?: any[]): T[];

Parameters

ParameterTypeDescription
idsany[]

Returns:

T[]

register method

Signature

typescript
register(ext: T): void;

Parameters

ParameterTypeDescription
extT

Returns:

void

selectOptions method

Signature

typescript
selectOptions(current?: string[], filter?: (ext: T) => boolean): RegistrySelectInfo;

Parameters

ParameterTypeDescription
currentstring[]
filter(ext: T) => boolean

Returns:

RegistrySelectInfo