@invincible_rd/my-npm-package-test
v1.0.3
Published
A description of your package
Downloads
115
Readme
My NPM Package
Overview
This package provides functionality to initialize and communicate with an Ultron AI embedded in an iframe. It includes methods for setting up the iframe, sending messages, and handling events.
Installation
To install the package, use npm:
npm install my-npm-package
Usage
To use the package, import the necessary functions in your TypeScript or JavaScript file:
import { initUltronAI, sendMessageContent, sendSubmitEvent } from 'my-npm-package';
Initializing Ultron AI
To initialize the Ultron AI, call the initUltronAI
function with the ID of the div where the iframe should be embedded and the link to the iframe content:
initUltronAI('myDivId', 'https://example.com/iframe-content');
Sending Messages
You can send messages to the iframe using the provided functions:
const iframe = document.getElementById('myDivId').querySelector('iframe');
// Send a text message
sendMessageContent(iframe, 'Hello, Ultron!', true, false, 'https://example.com');
// Send a submit event
sendSubmitEvent(iframe, 'https://example.com');
Contributing
Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.
License
This project is licensed under the MIT License. See the LICENSE file for details.