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 🙏

© 2026 – Pkg Stats / Ryan Hefner

vk-live-widget

v1.0.3

Published

VK Live Widget

Readme

Модуль для работы с Live Widget для обновления виджета сообщества Вконтакте.

Подключение

const LiveWidget = require("vk-live-widget");

const updateWidget = new LiveWidget("Токен приложения"); // Необходимо получить в приложении Live Widgrt https://vk.com/app6232540 Добавляем приложение в сообщество => Далее необходимо открыть приложение => Перейти в редактор кода => Найти синюю кнопку с рисунком ключа => Тыкаем и получаем ключ для обновления виджета сообщества

// Как найти ключ: https://drive.google.com/file/d/1yW6oqsKri7bfUTl9DLhFEyOrWy1vj9tA/view?usp=sharing

updateWidget({
  title: "Заголовок виджета",
  title_url: "vk.com/xop_enotov", // Ссылка откроется при нажатии на заголовок
  title_counter: 1, // Колтчество заголовков
  head: [
    {
      text: "Заголовок 1",
    },
    {
      text: "Заголовок 2",
      align: "right",
    },
  ],
  body: [
    {
      icon_id: `vk.com/xop_enotov`, // Иконка с аватаркой пользователя
      text: `1 поле`,
      url: `vk.com/xop_enotov`, // Ссылка откроется при нажатии на текст
    },
    {
      text: `2 поле`,
    },
  ],
  more: "Играть", // Кнопка под виджетом
  more_url: "vk.com/xop_enotov", // Ссылка при инажатии на кнопку под виджетом
});

В этом случае мы получим таблицу с 1 строкой и 2 столбцами

Пример использования для публикации топа пользователей грппы.

// Так будет выглядеть наш виджет: https://drive.google.com/file/d/13drrJOnG5txGR5L_4PWPDb1uwm80kwyL/view?usp=sharing

const LiveWidget = require("vk-live-widget"); // Подключаем библиотеку

const updateWidget = new LiveWidget("Токен приложения"); // Авторезируемя с помощью токена приложения

let users = Users.find({}); // Получаем массив пользователей из вашей базы данных

users.sort(function (a, b) {
  if (b.win > a.win) return 1;
  if (b.win < a.win) return -1;
  return 0;
}); // Сортируем пользоваелей по параметру (К примеру количество побед в игре за день)

var script = {
  title: "Топ игроков", // Заголовок виджета
  title_url: "vk.com/football.coin", // Ссылка откроется при нажатии на заголовок
  title_counter: 1,
  head: [
    {
      text: "Игрок:", // Заголовок первой колонки
    },
    {
      text: "Выиграл:", // Заголовок второй колонки
      align: "right",
    },
  ],
  body: [], // наш будующий виджет
  more: "Играть", // Кнопка под виджетом
  more_url: "vk.me/football.coin", // Ссылка откроится при нажатии на кноку
}; // Создаем разметку будующего виджета

// Далее с помощью цикла заполняем тело нашего виджета

const widget = () => {
  // Функция будет обновлять тело нашего скрипта
  for (let g = 0; g < 10; g++) {
    script.body = []; // Очищаем тело виджета
    script.body.push([
      {
        // Первую колонку заполнинм данными пользователя
        icon_id: `id${users[g].id}`, // id пользователя из нашего массива с бд
        text: `${users[g].tag}`, // Имя пользователя
        url: `vk.com/id${tops[g].idvk}`, // Откроется профиль пользователя при нажатии
      },
      {
        text: `${tops[g].win.toFixed(0)}`, // Вторая колонка будет содержать количество побед пользователей
      },
    ]);
  }
};

setInterval(() => {
  widget(); // Обновляем наш скрипт
  updateWidget.update(script); // Загружаем наш скрипт для обновления виджета группы
}, 180000); //Обновляем аиджет каждые 3 мин.

В результате получаем профит и стонкс