mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-21 00:09:51 +02:00
chore: Add tsdoc for registerLazyLoadedDiagrams
Co-authored-by: Alois Klink <alois@aloisklink.com>
This commit is contained in:
@@ -51,6 +51,19 @@ export const detectType = function (text: string, config?: MermaidConfig): strin
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Registers lazy-loaded diagrams to Mermaid.
|
||||
*
|
||||
* The diagram function is loaded asynchronously, so that diagrams are only loaded
|
||||
* if the diagram is detected.
|
||||
*
|
||||
* @remarks
|
||||
* Please note that the order of diagram detectors is important.
|
||||
* The first detector to return `true` is the diagram that will be loaded
|
||||
* and used, so put more specific detectors at the beginning!
|
||||
*
|
||||
* @param diagrams - Diagrams to lazy load, and their detectors, in order of importance.
|
||||
*/
|
||||
export const registerLazyLoadedDiagrams = (...diagrams: ExternalDiagramDefinition[]) => {
|
||||
for (const { id, detector, loader } of diagrams) {
|
||||
addDetector(id, detector, loader);
|
||||
|
Reference in New Issue
Block a user