UNPKG

@social-embed/lib

Version:

URL detection and parsing for embed providers (YouTube, other OEmbed compatible providers),

53 lines 1.68 kB
import { EmbedProvider } from './provider'; /** * Registry class for managing a collection of {@link EmbedProvider} instances. * * @remarks * This class allows you to register multiple providers, then discover which provider * can parse a particular URL. You can also retrieve a provider by its name. * * @public */ export declare class EmbedProviderRegistry { /** * Internal map storing each provider by name. * * @privateRemarks * We map `provider.name` -> `EmbedProvider`. */ private providers; /** * Creates an instance of {@link EmbedProviderRegistry}. */ constructor(); /** * Registers a provider. * * @remarks * If a provider with the same name is already present, it will be overwritten. * * @param provider - The {@link EmbedProvider} instance to register. */ register(provider: EmbedProvider): void; /** * Lists all registered providers. * * @returns An array of all currently registered {@link EmbedProvider} instances. */ listProviders(): EmbedProvider[]; /** * Retrieves a provider by name. * * @param name - A provider’s `name` property. * @returns The matching {@link EmbedProvider}, or `undefined` if not found. */ getProviderByName(name: string): EmbedProvider | undefined; /** * Finds the first provider that can parse the given URL. * * @param url - The URL to analyze. * @returns The matching {@link EmbedProvider}, or `undefined` if no provider recognizes it. */ findProviderByUrl(url: string): EmbedProvider | undefined; } //# sourceMappingURL=registry.d.ts.map