-
-
Notifications
You must be signed in to change notification settings - Fork 31
API
Embedo exposes following functions that you need after including the library:
The .load() function is all what you need to embed third party content given under following arguments.
embedo.load(<HTMLElement{}>, <URL[string|Array]>, <options[{}*optional]>)Due to incongruent third party restrictions regarding sizes, additional functionality called automagic is added, which basically auto-scales the container to fit within DOM without overflowing (enabled by default unless strict is set to true).
-
optionssee detailed explanation here.
Example
embedo
.load(HTMLElement, 'my://url/goes/here', { centerize: true })
.done(data => {})
.fail(err => {})For single instance with similar arguments, render method can alternatively be called which returns a callback instead.
embedo.render(<HTMLElement{}>, <URL[string]>, <options[{}*optional]>, <callback|Function>)-
optionssee detailed explanation here.
Embeds content in having data-embedo-url attribute to it. It will be called during init automatically, but also can be re-initialized with following call. Additional options can be passed with data-embedo-* suffix as shown in example here.
embedo.domify()-
optionssee detailed explanation here.
The embedo.refresh() method can be called explicitly when you have a change or resize event, which re-calculates the dimensions of generated content.
// Refresh single container
embedo.refresh(document.getElementById('my-element-id'));
// Refresh all embedo instances
embedo.refresh();The embedo.destroy() method can be called explicitly when wish to remove and unbind embedo instance(s).
// Destroy single container
embedo.destroy(document.getElementById('my-element-id'));
// Destroys all embedo instances
embedo.destroy();