Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 

πŸ—ƒ Embed widget

Add widgets to your website, powered by embedded frames.

⭐ Usage

Install the library as a dependency:

npm install embed-widget

Or, if you're using Yarn:

yarn add embed-widget

Then import the library:

import widget from "embed-widget";

And initialize it with an optional selector:

const embed = new widget("https://example.com", "Button text!");
<script src="https://unpkg.com/embed-widget"></script>

πŸ’» API

You can use the following methods with a widget:

Open/close/togggle

embed.open(); // Open the widget
embed.close(); // Close the widget
embed.toggle(); // Open if closed, close if opened

Remove

embed.destroy(); // Remove button and frame from DOM

πŸ› οΈ Development

Install dependencies:

yarn

Start local development server and Prettier watcher:

yarn start

Compile Typescript to ES6 before publishing to NPM:

yarn build

Releases

No releases published

Packages

No packages published