Skip to content

Mefistosss/sirv-media-viewer-script

Repository files navigation

Sirv Media Viewer script loader

Test

You can add Sirv Media Viewer script to your page as the documentation recommends or you can use this module.

This module adds Sirv Media Viewer script to page once.

install

npm install --save sirv-media-viewer-script

usage

import loadSMVScript from 'sirv-media-viewer-script';

loadSMVScript().then((sirv) => {
	// script is loaded
});

API

promise = loadSMVScript([attrs], [parentNode])

Append a <script> node with 'https://scripts.sirv.com/sirvjs/v3/sirv.js' URL to the <head> element in the DOM.

attrs (optional)

More about it you can find here

parentNode (optional)

More about it you can find here

promise

Returns a promise which resolves to the sirv object, or rejects with err if any occurred.