Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/anandchowdhary/embed-widget
🗃 Embeddable widgets for your website
https://github.com/anandchowdhary/embed-widget
dom embed iframe library typescript widget
Last synced: 3 months ago
JSON representation
🗃 Embeddable widgets for your website
- Host: GitHub
- URL: https://github.com/anandchowdhary/embed-widget
- Owner: AnandChowdhary
- License: mit
- Created: 2019-03-19T09:59:14.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2024-06-18T01:49:43.000Z (8 months ago)
- Last Synced: 2024-10-24T18:55:03.854Z (3 months ago)
- Topics: dom, embed, iframe, library, typescript, widget
- Language: TypeScript
- Homepage: https://anandchowdhary.github.io/embed-widget/
- Size: 131 KB
- Stars: 5
- Watchers: 3
- Forks: 1
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 🗃 Embed widget
Add widgets to your website, powered by embedded frames.
## ⭐ Usage
Install the library as a dependency:
```bash
npm install embed-widget
```Or, if you're using Yarn:
```bash
yarn add embed-widget
```Then import the library:
```js
import widget from "embed-widget";
```And initialize it with an optional selector:
```js
const embed = new widget("https://example.com", "Button text!");
``````html
```
## 💻 API
You can use the following methods with a widget:
### Open/close/togggle
```js
embed.open(); // Open the widget
embed.close(); // Close the widget
embed.toggle(); // Open if closed, close if opened
```### Remove
```js
embed.destroy(); // Remove button and frame from DOM
```## 🛠️ Development
Install dependencies:
```bash
yarn
```Start local development server and Prettier watcher:
```bash
yarn start
```Compile Typescript to ES6 before publishing to NPM:
```bash
yarn build
```