https://github.com/mefistosss/sirv-media-viewer-script
Add Sirv Media Viewer script to page
https://github.com/mefistosss/sirv-media-viewer-script
browser loader npm-module script sirv viewer
Last synced: over 1 year ago
JSON representation
Add Sirv Media Viewer script to page
- Host: GitHub
- URL: https://github.com/mefistosss/sirv-media-viewer-script
- Owner: Mefistosss
- License: mit
- Created: 2022-03-30T09:33:56.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-04-03T11:53:35.000Z (over 4 years ago)
- Last Synced: 2025-03-17T19:28:41.454Z (over 1 year ago)
- Topics: browser, loader, npm-module, script, sirv, viewer
- Language: TypeScript
- Homepage:
- Size: 138 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Sirv Media Viewer script loader
[](https://github.com/Mefistosss/sirv-media-viewer-script/actions/workflows/test.yml)
You can add Sirv Media Viewer script to your page as the [documentation](https://sirv.com/help/articles/sirv-media-viewer/) 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 `` 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](https://www.npmjs.com/package/load-script2#attrs-optional)
#### `parentNode` (optional)
More about it you can find [here](https://www.npmjs.com/package/load-script2#parentnode-optional)
#### `promise`
Returns a promise which resolves to the `sirv` object, or rejects with `err` if any occurred.