npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

user-satisfaction-survey

v0.1.3

Published

A cross-framework universal user satisfaction survey component based on Lit, for easy and quick integration of user satisfaction survey features.

Downloads

24

Readme

User Satisfaction Survey

A cross-framework universal user satisfaction survey component based on Lit, for easy and quick integration of user satisfaction survey features. 🚀🚀🚀

安装

  • 使用 cdn
<script src="https://npm.onmicrosoft.cn/user-satisfaction-survey@^0/dist/index.umd.js"></script>
  • 使用 npm
npm install user-satisfaction-survey
  • 使用 yarn
yarn add user-satisfaction-survey
  • 使用 pnpm
pnpm add user-satisfaction-survey

使用

基础用法

import { UserSatisfactionSurvey } from 'user-satisfaction-survey'

const userSatisfactionInstance = new UserSatisfactionSurvey([
  {
    id: 1,
    content: "我们的控制台操作方便,您能够快速找到关注的信息?"
  },
  {
    id: 2,
    content: "通过查阅文档,您能够轻松快速的解决集成中的问题?"
  },
  {
    id: 3,
    content: "我们的音视频质量很好,能够满足您的需求?"
  },
  {
    id: 4,
    content: "我们的 Demo 代码质量很好,能够帮助您缩短集成时间?"
  },
  {
    id: 5,
    content: "我们的 SDK 设计的很简单,您能够轻松快速的完成集成?"
  },
  {
    id: 6,
    content: "我们的技术支持,能够快速高效地帮助您解决问题?"
  },
]);

// 用户回答每个问题时触发该回掉函数
userSatisfactionInstance.on('questionCompleted', (res) => {
  console.log('questionCompleted', res)

  // id 为 4 的问题得分小于 3 时,删除 id 为 5 的问题,并在其后额外增加一个问题 
  if (res.questionId === 4 && res.score < 3) {
    userSatisfactionInstance.removeQuestionById(5)
    userSatisfactionInstance.addQuestion({
      id: 7,
      content: "我们的 Demo 场景丰富,能覆盖到您的使用场景?"
    }, res.index)
  }
})

// 用户完成整个问卷时触发该回掉函数
userSatisfactionInstance.on('completed', (res) => {
  console.log('completed', res)
})

window.addEventListener('load', () => {
  // 弹出用户满意度调查问卷
  userSatisfactionInstance.launch()
})

// 主动关闭弹窗
// userSatisfactionInstance.close()

// 销毁实例
// userSatisfactionInstance.destroy()