Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including statuspage.io-listener with all npm packages installed. Try it out:

var statuspageIoListener = require("statuspage.io-listener")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

statuspage.io-listener v1.0.0

A listener for statuspage.io incidents.

statuspage.io-listener

Discord David NPM version NPM downloads GitHub Issues GitHub Last Commit License

Installation

$ npm i --save statuspage.io-listener
const StatusPage = require("statuspage.io-listener")

// url, readFunction, writeFunction, { interval: 10000 }
// functions can also have async if wanted
let listener = new StatusPage.Listener("https://metastatuspage.com/history.rss", readFunction, writeFunction)

listener.on('ready', () => { console.log("Ready!") })
listener.on('error', error => { console.error(error) })
listener.on('newItem', item => { console.log(item) })

// Example Read & Write Functions
const fs = require("fs")

function readFunction() {
    return fs.readFileSync("./pubDate.txt", "utf8")
}

function writeFunction(pubDate) {
    fs.writeFileSync("./pubDate.txt", pubDate, "utf8")
}

Item Example

{ title: 'Postmortem editing unavailable for some customers',
  description: 'On further investigation this issue turned out to be isolated to embedding images in postmortems. We’re closing this incident and will instead be sending this through our usual lower priority bug flow. Please reach out to support if you run into any issues.',
  pubDate: 'Fri, 14 Dec 2018 12:43:46 -0800',
  link: 'https://metastatuspage.com/incidents/mybtvbp3fjby',
  guid: 'https://metastatuspage.com/incidents/mybtvbp3fjby',
  type: 'Resolved' }
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free