Socket
Book a DemoInstallSign in
Socket

poll-observer

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

poll-observer

observe poll loops

latest
Source
npmnpm
Version
2.1.2
Version published
Maintainers
1
Created
Source

poll-observer

Intro

poll-observer instruments XMLHttpRequest, setTimeout, setInterval, etc. to identify and report common poll loop patterns from the browser.

Usage

var pollObserver = require('poll-observer')
var shouldDisconnect = false
pollObserver.observe(function(data) {
  var entries = data.getEntries()
  entries.forEach(function(entry) {
    console.info('poll entry:', data.pollId, entry.type, entry.url)
  })

  if (shouldDisconnect) {
    pollObserver.disconnect()
  }
})

Example output

poll entry: 0 poll http://mysite.com/data.json?reqIndex=0
poll entry: 0 poll http://mysite.com/data.json?reqIndex=1

.... sometime later, maybe ...
poll entry: 0 poll http://mysite.com/data.json?reqIndex=2

.... and even later, maybe ...
poll entry: 0 poll http://mysite.com/data.json?reqIndex=3

Keywords

xhr

FAQs

Package last updated on 27 Jan 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts