@enaio-client/communication-library
Version:
The Communication Library facilitates secure cross-origin communication between the enaio® webclient and dashlets/modal dialogs, using window.postMessage(). This library streamlines the process, ensuring compatibility with the enaio® client, and offers an
72 lines (53 loc) • 1.73 kB
Markdown
The Communication Library facilitates secure cross-origin communication between the enaio® webclient and dashlets/modal dialogs, using `window.postMessage()`. This library streamlines the process, ensuring compatibility with the enaio® client, and offers an effortless solution for managing `postMessage` communication, enhancing the usability and interoperability of your applications.
```sh
npm install @enaio-client/communication-library
```
In your main.js file:
```javascript
import * as lib from 'node_modules/@enaio-client/communication-library/dist/module.js';
```
**In later versions, support for the below will be added:**
Import the library using CommonJS or ES6 module syntax:
**CommonJS:**
```javascript
const lib = require('@enaio-client/communication-library');
```
**ES6:**
```javascript
import * as lib from '@enaio-client/communication-library';
```
Access the library using the global variable defined in your build configuration:
```javascript
var lib = window.CommunicationLibrary;
```
```javascript
lib.registerOnInitCallback(onInit);
function onInit(data) {
// Initialization logic here
}
```
```javascript
async function openIndexData() {
try {
await lib.openIndexData(false, 'edit', 'objectId');
} catch (error) {
console.error(error);
}
}
```
- optimal-systems
- enaio
- communication-library
This project is licensed under the ISC License.