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

vue-polling

v0.1.14

Published

Vue plugin for polling backend APIs

Readme

vue-polling

Vue plugin for polling backend APIs

Observers

Observers would fire HTTP Get calls periodically to the backend APIs. After you call Vue.use(VuePolling), you would have a $polling object in your Vue.prototype. With $polling you can manage your observers.

Define observer(s)

this.$polling.addObserver(url)

or with opts:

this.$polling.addObserver(url, {
    interval: 5000,  // 2000ms by default
    maxFails: 10,    // break after 10 (5 by defualt) continuous failures
    headers: {
        'Content-Type': 'application/json'
    }
})

As soon as your call addObserver(), the observer you just defined would start to fire the polling calls.

NOTE

  • The url is the unique key of an observer. No duplicated observers of the same url in your whole Vue project.

Stop and remove observers

this.$polling.removeObserver(url)

Listeners

Listeners are normally defined and manipulated in Vue components. The package provides the mixin that injects listeners object in this.$options.

Define listener(s)

this.$options.listeners['url1'] = (resp) => {
    // do with HTTP response object
}

Remove listener(s)

delete this.$options.listeners['url1']

This will delete all callbacks defined in this vm for the url 'url1'.

Explanation

  • You can define multiple callbacks to one single url. That means if you execute the code in 'Define a listner' twice, you would get two callbacks for that url. And it's possible to define same callbacks for same url but in different Vue components.
  • When you delete listeners in a Vue component with a url, you are deleting all callbacks you've defined in that Vue component with the same url. But it would not affect callbacks defined in other Vue components with the same url.