1.0.1 • Published 29 days ago

@stealthex-io/widget v1.0.1

Weekly downloads
-
License
ISC
Repository
github
Last release
29 days ago

Build Size Version Maintained Issues

StealthEX brings you a handy cryptocurrency exchange widget for crypto-related websites. Exchanges are always private, custody-free and take just a couple of clicks (and a personal wallet) to perform.

All the swaps made with the widget grant you profit + the appearance and assets you would like to highlight are customizable. Register is StealthEX Partner Account to track the stats and get all the info on our affiliate tools here.

Install

npm

npm install @stealthex-io/widget
import widget from "@stealthex-io/widget"

CDN (unpkg)

https://unpkg.com/@stealthex-io/widget/dist/index.browser.js

This version creates window.stealthexWidget object with all exported methods.

Create a container and attach id to it

<div id="stealthex-widget-container"></div>

Initialize your widget

  1. Copy your widget id in the Partner profile Code tab

  2. Use the init method:

const cleanup = widget.init("your-id")
  1. init returns a cleanup function that you can use to prevent memory leaks

Optionally listen to events

const handler = () => {
  console.log("Exchange started!")
}

widget.events.on("exchangestart", handler)
widget.events.off("exchangestart", handler)

API

init(id, options)

Returns a cleanup function: () => void

id

Type: string

This is your widget id that you can get in the Partner profile Code tab.

options

Type: object

KeyTypeDescriptionDefault value
sizenumberWidget width size330
containerIdstringHTML container id where widget will be mountedstealthex-widget-container
iframeHoststringThe widget iframe base URLhttps://stealthex.io

events.on(event, listener)

Returns: void

event

Type: string

Available events:

EventValue
exchangestartundefined
statuschangestring

listener

Type: (data) => void

events.off(event, listener)

Returns: boolean (false if listener wasn't subscribed to event)

listener

Type: (data) => void

The listener that was previously subscribed.

1.0.1

29 days ago

1.0.0

1 year ago