@bookmap/bmmp-embed
v1.0.1
Published
Utilities for Bookmap Web embedding
Readme
Bookmap Web Embed Library
bmmp-embed is a library that lets you embed Bookmap Web chart to your website using vanilla JavaScript.
Installation
As NPM package
Requirements:
- yarn or npm
Install using your favourite package manager:
yarn add @bookmap/bmmp-embedor
npm install --save @bookmap/bmmp-embedImport the library and create your embed:
import { createIframe } from '@bookmap/bmmp-embed';
createIframe({
url: 'https://embed.web.bookmap.com/',
container: document.querySelector('#bookmap-web-container')
})Configuration
const { iframe, changeInstrument } = createIframe(options)The createIframe function returns:
iframe– created iframe elementchangeInstrument– changes instrument in the iframe. Works even if app not loaded yet
Options
options is an object with iframe properties:
| name | type | description | default | |--------------|-------------|------------------------------------------------------------------------------------------------------------------------------------|------------| | url | string | URl of the Bookmap Web application to embed | - | | [container] | HTMLElement | an element to attach the iframe to. If container is undefined, an iframe is created, but it is not appended to any parent element. | undefined | | [authData] | AuthData | Includes the protocol to use and the necessary data for it | NoAuthData | | [instrument] | string | alias of the instrument to be opened in the widget. If no instrument is passed, it will be chosen automatically | undefined | | [width] | string | width of the widget in CSS units | '100%' | | [height] | string | height of the widget in CSS units | '100%' |
