Custom Feedback Widget In JavaScript – Feeedback

Category: Javascript | July 25, 2019
Author: AnandChowdhary
Views Total: 958 views
Official Page: Go to website
Last Update: July 25, 2019
License: MIT

Preview:

Custom Feedback Widget In JavaScript – Feeedback

Description:

Feeedback is a JavaScript library which displays a feedback widget in a modal popup.

It provides an onSubmit callback which allows you easily send feedbacks (emojis and messages) to the backend.

How to use it:

Install and download the Feeedback package.

# Yarn
$ yarn add feeedback

# NPM
$ npm install feeedback --save

Import the Feeedback.

import Feeedback from "feeedback";

Or load the compiled version from a CDN.

Create a new feedback instance.

var feedbackWidget = new window.Feeedback({
    onSubmit: feedback => new Promise((resolve, reject) => {
      // feedback.rating: rating value
      // feedback.message: feedback message
    });
});

Open the feedback popup.

feedbackWidget.open();

Event handlers.

feedbackWidget.on("ready", result => {
  // on ready
});

feedbackWidget.on("beforeCreate", result => {
  // before creation
});

feedbackWidget.on("created", result => {
  // after created
});

feedbackWidget.on("open", result => {
  // on open
});

feedbackWidget.on("close", result => {
  // on close
});

feedbackWidget.on("beforeSubmit", result => {
  // before submit
});

feedbackWidget.on("submit", result => {
  // on submit
});

feedbackWidget.on("error", result => {
  // when there is an error
});

feedbackWidget.on("reset", result => {
  // on reset
});

feedbackWidget.on("finish", result => {
  // on finish
});

You Might Be Interested In:


Leave a Reply