feat(adapters): instantiated AdapterRegistry

instanced the AdapterRegistry so there only would be one accessible registery everywhere
accessible and registerd the native adapter in barrel file (index.ts file)
This commit is contained in:
2026-04-29 23:28:15 +03:30
parent ec89f3826e
commit f663957ace
2 changed files with 9 additions and 1 deletions

View File

@@ -13,7 +13,7 @@ type AdapterConstructor = new (
options?: AdapterConfig
) => AdapterAPI;
export class AdapterRegistry {
class AdapterRegistry {
private adapters: Map<string, AdapterConstructor> = new Map();
registerAdapter(type: string, constructor: AdapterConstructor): void {
@@ -35,3 +35,5 @@ export class AdapterRegistry {
return new construct(video, options);
}
}
export const adapterRegistry = new AdapterRegistry();

View File

@@ -1 +1,7 @@
import { adapterRegistry } from './AdapterRegistry';
import { NativeAdapter } from './Native';
adapterRegistry.registerAdapter('native', NativeAdapter);
export { adapterRegistry } from './AdapterRegistry';
export { NativeAdapter } from './Native';