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

phonegap-soundwave

v0.7.0

Published

Connect middleware to stream a PhoneGap app.

Downloads

14

Readme

phonegap-soundwave Build Status

Connect middleware to stream a PhoneGap app.

Examples

Standalone

var soundwave = require('phonegap-soundwave');
soundwave.serve();

Express

var soundwave = require('phonegap-soundwave'),
    express = require('express'),
    app = express();

app.use(soundwave());
app.listen(3000);

Connect

var soundwave = require('phonegap-soundwave'),
    connect = require('connect'),
    app = connect();

app.use(soundwave());
app.listen(3000);

HTTP

var soundwave = require('phonegap-soundwave'),
    http = require('http');

var server = http.createServer(soundwave());
server.listen(3000);

API

var soundwave = require('phonegap-soundwave');

soundwave()

Returns a http.Server request listener that is also a compatible connect middleware function.

Returns:

  • {Function} request listener

soundwave.serve(options, [callback])

Creates a local server to serve up the project. The intended receiver is the PhoneGap App but any browser can consume the content.

Options:

  • options
    • port {Number} to listen on (Default: 3000).
    • [autoreload] {Boolean} toggle AutoReload watch (default: true).
  • callback {Function}
    • e {Error} is null unless there is an error.
      • data {Object}
        • server {http.Server} is the server running.
        • address {String} is the server address.
        • port {Number} is the server port.

Events:

  • error is emitted when an error occurs.
  • log is emitted with server log info.

soundwave.create(options)

The project is created from the same app template used by the PhoneGap CLI and Cordova CLI. When a template does not exist, it is fetched and saved in the common directory:

~/.cordova/lib/www/phonegap/VERSION/

Options:

  • options {Object}
    • path {String} is the path to create the project.
    • version {String} defines the PhoneGap app version.

Events:

  • progress emits state while downloading the app template.
    • state {Object} with received, total, and percentage.
  • error emitted when an error occurs.
    • e {Error}
  • complete emits when the project has been created.
    • data {Object} is indentical to the input options.

Example:

soundwave.create({
    path: 'path/to/app',
    version: '3.3.0'
})
.on('progress', function(state) {
    // only emitted when downloading a template.
    // state values are only defined when response supports
    // content-length header.
    if (state.percentage) {
        console.log('downloaded: ' + state.percentage + '%');
    }
}
.on('error', function(e) {
    // handle error
})
.on('complete', function(data) {
    // data.path is the app path
    console.log('created project at: ' + data.path);
});