Shobhit Sharma edited this page Oct 16, 2017 · 6 revisions

Embedo exposes following functions that you need after including the library:

.load()

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).

Example

embedo
 .load(HTMLElement, 'my://url/goes/here', { centerize: true })
 .done(data => {})
 .fail(err => {})

.render()

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>)

Example

embedo.render($('#el').get(0), 'my://url/goes/here', function (err, result) {
  if (err) {
    return err;
  }
  console.log('Embedo rendered', result);
})

.refresh()

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();

.destroy()

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();
Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.