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 🙏

© 2024 – Pkg Stats / Ryan Hefner

pushalot-node

v0.0.1

Published

easily access the pushalot push API (http://pushalot.com/)

Downloads

5

Readme

pushalot-node

About

pushalot-node is a very small NodeJS module for the Pushalot REST API (http://pushalot.com) to push notifications (toasts) to Windows 8 and Windows Phone with a straight forward API.

Requirements

To send notifications to a device you need to obtain the corresponding authorization token. To test the service and send notifications to your own device you can use your default "api" token (https://pushalot.com/manager/authorizations) or create a custom app (https://pushalot.com/manager/apps).

Usage

var Pushalot = require('pushalot-node')

var client = new Pushalot( "aBcDEfAuthorizationToken" )

client.push('I am a test notification')
.on('success', function ( code , res ) {
  //
})
.on('error', function (code , res ) {
  //
})

new Pushalot(token)

The Pushalot method requires an authorization token and returns a client object

var client = new Pushalot(authorizationToken)

client.push(...)

In order to send notifications to the user, simply call push on the client. The push method exposes different signatures

client.push(message, [title], [args])

/**
 * @param {String} message    message that will be sent
 * @param {String} [title]    notification title
 * @param {Object} [args]     prepared object with additional information
 */
client.push(message, title, args)

// examples
client.push('just testing')
client.push('another test', 'Headline')
client.push('something happened', 'Important', {IsImportant: true})

client.push(args)

/**
 * @param {Object} args         prepared object with all information
 */
client.push(args)

// example
client.push({ Body: 'text'
            , Title: 'Title'
            , Link: 'http://www.reddit.com/r/pushalot/'
            })

Please see the Pushalot API (http://pushalot.com/api) docs for information on the available keys/values for the args object

Events

push returns an EventEmitter so you can easily listen to the result

var toast = client.push('my cat can eat a whole watermelon')

toast.on('success', cb)

/**
 * @param   {Number}  code      HTTP statusCode
 * @param   {String}  res       body of response (may contain additional information)
 */
toast.on('success', function ( code, res ) {
    //...
})

code will always be 200 on success

toast.on('error', cb)

/**
 * @param   {Number}  code      HTTP statusCode
 * @param   {String}  res       body of response (may contain additional information)
 */
toast.on('error', function ( code, res ) {
    //...
})

If something went wrong, you can lookup the code at the Pushalot API (http://pushalot.com/api#basics) to debug your application. The response body (res) may also contain helpful information.

Pushalot.source

In case you want to display a custom application-wide source name instead of the registered name of your app, just assign a string to Pushalot.source

 var Pushalot = require('pushalot-node')

 Pushalot.source = 'my application'