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:
@@ -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();
|
||||
|
||||
@@ -1 +1,7 @@
|
||||
import { adapterRegistry } from './AdapterRegistry';
|
||||
import { NativeAdapter } from './Native';
|
||||
|
||||
adapterRegistry.registerAdapter('native', NativeAdapter);
|
||||
|
||||
export { adapterRegistry } from './AdapterRegistry';
|
||||
export { NativeAdapter } from './Native';
|
||||
|
||||
Reference in New Issue
Block a user