Home Reference Source Test Repository
import URLEmbedProvider from 'url-embed/lib/classes/URLEmbedProvider.js'
public interface | source

URLEmbedProvider

Converts a pattern of URLs into markup

Test:

Constructor Summary

Public Constructor
public

constructor(urlPatterns: Array<RegExp>)

Member Summary

Public Members
public

Method Summary

Public Methods
public

configure(engineOptions: Object)

Stub method caled by EmbedEngine.

public

errorMarkup(embed: Embed): *

Returns markup if an error occurs resolving the embed

public

filterData(data: {html: String})

Can be overridden/replaced to modify a specific provider's data before it is passed to the client callback.

public

getEmbed(embed: Embed, callback: function(error: Error, data: Object))

Resolves options.embedURL to an embed and passes it to callback.

public

isMatch(embedURL: String): boolean

Determines if a given URL matches this provider

Public Constructors

public constructor(urlPatterns: Array<RegExp>) source

Params:

NameTypeAttributeDescription
urlPatterns Array<RegExp>

array of regular expressions that this provider will match

Test:

Public Members

public urlPatterns: * source

Public Methods

public configure(engineOptions: Object) source

Stub method caled by EmbedEngine. Can be overridden.

Params:

NameTypeAttributeDescription
engineOptions Object

public filterData(data: {html: String}) source

Can be overridden/replaced to modify a specific provider's data before it is passed to the client callback.

Params:

NameTypeAttributeDescription
data {html: String}

Data object containing embed html

Test:

public getEmbed(embed: Embed, callback: function(error: Error, data: Object)) source

Resolves options.embedURL to an embed and passes it to callback.

Params:

NameTypeAttributeDescription
embed Embed

Embed object

callback function(error: Error, data: Object)

callback to invoke after resolving embed

Test: