Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | 4x 13x 13x 1x 1x 12x 10x 3x 5x 25x 4x | 'use strict';
import IObservableBackend from './i.observable.backend';
export default class BackendRegistry {
public static register(observe: string, backend: IObservableBackend): void {
const existing: IObservableBackend | undefined = BackendRegistry._backends.get(observe);
if (existing) {
console.warn(
`[@owservable/core] -> BackendRegistry: duplicate backend registration for "${observe}" ignored, keeping ${existing.constructor.name} and rejecting ${backend.constructor.name}`
);
return;
}
BackendRegistry._backends.set(observe, backend);
}
public static get(observe: string): IObservableBackend | null {
return BackendRegistry._backends.get(observe) ?? null;
}
public static has(observe: string): boolean {
return BackendRegistry._backends.has(observe);
}
public static keys(): string[] {
return Array.from(BackendRegistry._backends.keys());
}
public static clear(): void {
BackendRegistry._backends.clear();
}
private static readonly _backends: Map<string, IObservableBackend> = new Map<string, IObservableBackend>();
private constructor() {}
}
|