import internalHTMLElementModels, {
DefaultHTMLElementModelsStatic
} from './defaultHTMLElementModels';
import HTMLElementModel from './HTMLElementModel';
import { HTMLModelRecord, TagName } from './model-types';
export default class HTMLModelRegistry {
public readonly modelRecords: HTMLModelRecord =
internalHTMLElementModels as HTMLModelRecord;
constructor(
customize?: (
defaultHTMLElementModels: DefaultHTMLElementModelsStatic
) => HTMLModelRecord
) {
if (typeof customize === 'function') {
this.modelRecords = customize(internalHTMLElementModels);
}
}
getElementModelFromTagName(
tagName: E | TagName
): HTMLElementModel | null {
if (tagName in this.modelRecords) {
return this.modelRecords[tagName];
}
return null;
}
}