EmbedEngine
Resolves urls to embeds from a registered list of embed providers
Constructor Summary
Public Constructor | ||
public |
constructor(engineOptions: Object) |
Member Summary
Public Members | ||
public |
Array of provider classes included in this library |
|
public |
The directory containing the default provider classes |
|
public |
Configuration options. |
|
public |
The registry of provider instances |
|
public |
providerSuperClasses: {URLEmbedProvider: URLEmbedProvider, OEmbedProvider: OEmbedProvider} Utility references to provider superclasses |
Method Summary
Public Methods | ||
public |
errorMarkupNoMatchingProvider(embed: Embed): * Returns error markup if there was no provider that matched the embedURL |
|
public |
filterData(data: {html: string}) Can be overridden/replaced to modify any provider's data before it is passed to the client callback. |
|
public |
Resolves an Embed object, populating its data property and calling the callback |
|
public |
getMultipleEmbeds(optArray: *, callback: *) |
|
public |
registerDefaultProviders(path: String) Registers all the default providers in this library |
|
public |
registerProvider(provider: URLProvider) Registers a provider instance. |
Public Constructors
Public Members
public defaultProviderClasses: Array<URLEmbedProvider> source
Array of provider classes included in this library
public defaultProviderDirectory: String source
The directory containing the default provider classes
public engineOptions: Object source
Configuration options. These will also be passed to the configure method of each provider instance
Properties:
Name | Type | Attribute | Description |
engineOptions.timeoutMs | number | request timeout in milliseconds |
public providerSuperClasses: {URLEmbedProvider: URLEmbedProvider, OEmbedProvider: OEmbedProvider} source
Utility references to provider superclasses
Public Methods
public errorMarkupNoMatchingProvider(embed: Embed): * source
Returns error markup if there was no provider that matched the embedURL
Params:
Name | Type | Attribute | Description |
embed | Embed | Embed object |
Return:
* |
public filterData(data: {html: string}) source
Can be overridden/replaced to modify any provider's data before it is passed to the client callback.
Note: if you only need to modify a specific provider's data then there's a similar filterData
method on each provider object, too.
Params:
Name | Type | Attribute | Description |
data | {html: string} | Data object containing embed html |
public getEmbed(embed: Embed, callback: function(embed: Embed)) source
Resolves an Embed object, populating its data property and calling the callback
public getMultipleEmbeds(optArray: *, callback: *) source
Params:
Name | Type | Attribute | Description |
optArray | * | ||
callback | * |
public registerDefaultProviders(path: String) source
Registers all the default providers in this library
Params:
Name | Type | Attribute | Description |
path | String |
|
directory of provider classes (if not specified it will default to the ones in this library) |
public registerProvider(provider: URLProvider) source
Registers a provider instance.
Highlander Rule: this provider will replace an already registered provider if they have the same name property.
Params:
Name | Type | Attribute | Description |
provider | URLProvider | instance of |