This package provides the _IDD Profiling_ widget by Munich Re Markets for integration into your website.
If you use NPM as a package manager, run
``shell`
npm install --save @munichremarkets/idd-profiling
And if you use Yarn:
`shell`
yarn add @munichremarkets/idd-profiling
The IDD Profiling widget provides a (plain JavaScript) rendering API in the form of the renderIddProfiling functionunmount
that is used to display the widget on the page and pass data to the widget.
This function additionally returns an object containing an and rerender function which you can respectively use
to unmount the widget or rerender the widget with new parameters during runtime
The IDD Profiling package contains JavaScript (ES5) code in both ECMAScript and UMD (Universal Module Definition)
module formats, so you need to use a bundler that supports either of these formats, such as Webpack or Rollup. Using
ES6-style imports, your code might look like this:
`javascript`
import { renderIddProfiling } from '@munichremarkets/idd-profiling';
TypeScript declaration files (.d.ts) are also included in the package, providing typings and enhanced IDE support for
the rendering API.
In order to render the widget, you need to invoke the renderIddProfiling rendering function that is made available as
described above. The following data needs to be provided when invoking the rendering function:
- A target DOM element (typically a
element) into which the widget should be rendered
- A configuration object providing data to the widget, see section "Configuring the widget" belowThe rendering function returns an object containing both an
unmount and rerender function for the widget.For example, a call to the rendering function might look like this (ES6):
`javascript
const target = document.getElementById('widget-target');renderIddProfiling(target, {
/ configuration data, see below /
}).then(() => {
/ code to be executed when the rendering is complete /
});
`Please make sure to invoke the rendering function after the DOM has been loaded, e.g. by putting the call into
a