phonegap-soundwave
Advanced tools
Comparing version 0.4.1 to 0.5.0
@@ -38,13 +38,2 @@ /*! | ||
/** | ||
* Listen for connections. | ||
* | ||
* A convenience method to start a node `http.Server` instance. | ||
*/ | ||
module.exports.listen = function() { | ||
var server = http.createServer(middleware()); | ||
return server.listen.apply(server, arguments); | ||
}; | ||
/** | ||
* Serve a PhoneGap app. | ||
@@ -60,2 +49,3 @@ * | ||
* - `[port]` {Number} is the server port (default: 3000). | ||
* - `[autoreload]` {Boolean} toggle AutoReload watch (default: true). | ||
* - `[callback]` {Function} is triggered when server starts. | ||
@@ -79,4 +69,4 @@ * - `e` {Error} is null unless there is an error. | ||
// start the server | ||
var server = module.exports.listen(options.port); | ||
// create the server | ||
var server = http.createServer(middleware(options)); | ||
@@ -103,2 +93,5 @@ // bind error | ||
}); | ||
// start the server | ||
return server.listen(options.port); | ||
}; | ||
@@ -105,0 +98,0 @@ |
@@ -13,3 +13,4 @@ /*! | ||
nocache = require('./middleware/nocache'), | ||
plugins = require('./middleware/plugins'); | ||
plugins = require('./middleware/plugins'), | ||
autoreload = require('./middleware/autoreload'); | ||
@@ -23,23 +24,26 @@ /** | ||
module.exports = function() { | ||
module.exports = function(options) { | ||
var app = connect(); | ||
// no-cache header | ||
app.use(nocache()); | ||
app.use(nocache(options)); | ||
// watch file system for changes and notify client | ||
app.use(autoreload(options)); | ||
// inject JavaScript to refresh app or navigate home | ||
app.use(inject()); | ||
app.use(inject(options)); | ||
// serve static assets | ||
app.use(mstatic()); | ||
app.use(mstatic(options)); | ||
// serve cordova js if 404'd out from previous static server | ||
app.use(cordova()); | ||
app.use(cordova(options)); | ||
// serve cordova_plugin js if 404'd out from previous static server | ||
app.use(cordova_plugins()); | ||
app.use(cordova_plugins(options)); | ||
// serve plugins if 404'd out from previous static server | ||
app.use(plugins()); | ||
app.use(plugins(options)); | ||
// return the request listener | ||
@@ -46,0 +50,0 @@ return function(req, res, next) { |
@@ -19,3 +19,4 @@ /*! | ||
homepageScript = path.join(__dirname, '../../res/middleware/homepage.js'), | ||
refreshScript = path.join(__dirname, '../../res/middleware/refresh.js'); | ||
refreshScript = path.join(__dirname, '../../res/middleware/refresh.js'), | ||
autoreloadScript = path.join(__dirname, '../../res/middleware/autoreload.js'); | ||
@@ -26,5 +27,6 @@ return inject({ | ||
fs.readFileSync(homepageScript), | ||
fs.readFileSync(refreshScript) | ||
fs.readFileSync(refreshScript), | ||
fs.readFileSync(autoreloadScript) | ||
] | ||
}); | ||
}; |
{ | ||
"name": "phonegap-soundwave", | ||
"description": "Connect middleware to stream a PhoneGap app.", | ||
"version": "0.4.1", | ||
"version": "0.5.0", | ||
"homepage": "https://github.com/phonegap/node-phonegap-soundwave", | ||
@@ -24,2 +24,3 @@ "repository": { | ||
"connect-inject": "0.3.2", | ||
"gaze" : "0.4.3", | ||
"home-dir": "0.1.2", | ||
@@ -26,0 +27,0 @@ "node-static": "0.7.0", |
@@ -10,3 +10,3 @@ # phonegap-soundwave [![Build Status][travis-ci-img]][travis-ci-url] | ||
var soundwave = require('phonegap-soundwave'); | ||
soundwave.listen(3000); | ||
soundwave.serve(); | ||
@@ -52,17 +52,7 @@ ### Express | ||
### soundwave.listen(port, [options]) | ||
Create an `http.Server` and listen on the specified port. | ||
All arguments are passed directly into `http.listen(...)`. | ||
See [http.listen](http://nodejs.org/api/http.html#http_server_listen_path_callback) | ||
for details. | ||
Returns: | ||
- {Object} that is an `http.Server` instance. | ||
### soundwave.serve(options, [callback]) | ||
Convenience method to `soundwave.listen(...)` that supports PhoneGap CLI events. | ||
Creates a local server to serve up the project. The intended | ||
receiver is the PhoneGap App but any browser can consume the | ||
content. | ||
@@ -73,2 +63,3 @@ Options: | ||
- `port` {Number} to listen on (Default: 3000). | ||
- `[autoreload]` {Boolean} toggle AutoReload watch (default: true). | ||
- `callback` {Function} | ||
@@ -75,0 +66,0 @@ - `e` {Error} is null unless there is an error. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
267742
42
6596
9
122
+ Addedgaze@0.4.3
+ Addedgaze@0.4.3(transitive)
+ Addedglob@3.1.21(transitive)
+ Addedglobule@0.1.0(transitive)
+ Addedgraceful-fs@1.2.3(transitive)
+ Addedinherits@1.0.2(transitive)
+ Addedlodash@1.0.2(transitive)
+ Addedlru-cache@2.7.3(transitive)
+ Addedminimatch@0.2.14(transitive)
+ Addedsigmund@1.0.1(transitive)