@userback/widget
TypeScript icon, indicating that this package has built-in type declarations

0.3.2 • Public • Published

@userback/widget

The official NPM module for embedding the Userback.io widget into your Javascript or Typescript application.

Installation

npm i @userback/widget or yarn add @userback/widget

Quickstart

import Userback from '@userback/widget'
Userback('**USERBACK_TOKEN**')

Examples

Show the Userback Widget immediately after loading on the bug screen.

Userback(..).then(ub => {
    ub.show()
})

Or delay showing it until later:

Userback(.., { autohide: true }).then(ub => {
    document.querySelector('button.show-feedback').addEventListener('click', function(){
        ub.show()
    })
})

Using the options object to enable native screenshots while binding screenshots to a HTML button:

const userback = await Userback(..., { navtive_screenshot: true })
document.querySelector('button.screenshot').addEventListener('click', (event) => {
    event.preventDefault()
    userback.open('bug', 'screenshot')
})

After initialisation, you can use the named function getUserback to get a reference to the UserbackWidget.

import { getUserback } from '@userback/widget'

document.querySelector('button.screenshot').addEventListener('click', (event) => {
    event.preventDefault()
    getUserback().open('bug', 'screenshot')
})

For more information about available configuration settings and and functions available, see our Javascript API

Dependents (4)

Package Sidebar

Install

npm i @userback/widget

Weekly Downloads

13,885

Version

0.3.2

License

MIT

Unpacked Size

26.7 kB

Total Files

7

Last publish

Collaborators

  • shard
  • lle_userback