Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bing-pulse

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bing-pulse

consume bing pulse api

  • 0.1.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
increased by50%
Maintainers
1
Weekly downloads
 
Created
Source

bing-pulse

NPM version Dependency Status Gitter

Consume Bing Pulse API

Installation

With npm do:

npm install bing-pulse

Example


  var pulse = require('bing-pulse').create();

  pulse.init({
    pulseApiKey: '',
    customerApiKey: ''
  });

  pulse.on('questions', function questions(data) {});

  pulse.on('pulses', function pulses(data) {});

  pulse.on('annotations', function annotations(data) {});

  pulse.on('error', function error(err) {});

Methods

Require and create new pulse.

  var pulse = require('bing-pulse').create();

pulse.init(opts)

Initialize pulse by passing your bing pulse and customer API keys.

  var opts = {
    pulseApiKey: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
    customerApiKey: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' //optional
  };

  pulse.init(opts);

Available options:

  • opts.pulseApiKey your bing pulse API key
  • opts.customerApiKey your bing customer API key (optional)
  • opts.interval how often to check the pulse in seconds (optional)
  • opts.inactive set to neutral to default graph point to 0 or previous to default graph point to previous one if users inactive (optional)

By default bing pulse API returns only graph points if users actually voted. Assuming you're plotting in 5s intervals you'd expect to get 6 graph points in 30s. If no users voted you'll get 0 graph points. Use opts.inactive to plot the points or omit to get the default bing pulse API behaviour.

pulse.endpoints(cb)

Get an array of available API endpoints you can listen on.

  pulse.endpoints(function endpoints(data) {});

Events

List of available events.

pulse.on('questions', cb);

Listen on questions.

  pulse.on('questions', function questions(data) {});

pulse.on('pulses', cb);

Listen on pulses.

  pulse.on('pulses', function pulses(data) {});

pulse.on('annotations', cb)

Listen on pulse annotations.

  pulse.on('annotations', function annotations(data) {});

pulse.on('stats', cb)

Listen on request stats.

  pulse.on('stats', function stats(data) {});

pulse.on('error', cb)

Listen on errors.

  pulse.on('error', function error(err) {});

Listen on endpoints

Listen on available bing pulse API endpoints.

  pulse.on('endpoints:meta', function meta(data) {});

  pulse.on('endpoints:pulses', function pulses(data) {});

  pulse.on('endpoints:questions', function questions(data) {});

  pulse.on('endpoints:customer', function customer(data) {});

To do

  • questions
  • pulses
  • annotations
  • quizzes

License

MIT

Keywords

FAQs

Package last updated on 11 Oct 2015

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc