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

phonegap-soundwave

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

phonegap-soundwave - npm Package Compare versions

Comparing version 0.5.4 to 0.6.0

19

lib/index.js

@@ -68,2 +68,5 @@ /*!

// attach the emitter object to options
options.emitter = emitter;
// create the server

@@ -74,3 +77,3 @@ var server = http.createServer(middleware(options));

server.on('error', function(e) {
module.exports.emit('error', e);
emitter.emit('error', e);
callback(e);

@@ -81,3 +84,3 @@ });

server.on('request', function(req, res) {
module.exports.emit('log', res.statusCode, req.url);
emitter.emit('log', res.statusCode, req.url);
});

@@ -93,3 +96,3 @@

module.exports.emit('log', 'listening on', data.address + ':' + data.port);
emitter.emit('log', 'listening on', data.address + ':' + data.port);
callback(null, data);

@@ -110,3 +113,5 @@ });

module.exports.on = emitter.on;
module.exports.on = function() {
emitter.on.apply(emitter, arguments);
};

@@ -117,3 +122,5 @@ /**

module.exports.emit = emitter.emit;
module.exports.emit = function() {
emitter.emit.apply(emitter, arguments);
};

@@ -124,2 +131,2 @@ /*!

module.exports.on('error', function(e){});
emitter.on('error', function(e){});

@@ -38,2 +38,6 @@ /*!

outdated = true;
if (options.emitter) {
options.emitter.emit('log', 'file changed', filepath);
}
});

@@ -46,6 +50,13 @@ }

if (req.url.indexOf('autoreload') >= 0) {
res.writeHead(200, { 'Content-Type' : 'text/json' });
res.end(JSON.stringify({ outdated : outdated }));
outdated = false;
} else {
if (req.method === 'GET') {
res.writeHead(200, { 'Content-Type' : 'text/json' });
res.end(JSON.stringify({ outdated : outdated }));
}
else if (req.method === 'POST'){
res.writeHead(200, { 'Content-Type' : 'text/json' });
outdated = false;
res.end(JSON.stringify({ outdated : outdated }));
}
}
else {
next();

@@ -52,0 +63,0 @@ }

{
"name": "phonegap-soundwave",
"description": "Connect middleware to stream a PhoneGap app.",
"version": "0.5.4",
"version": "0.6.0",
"homepage": "https://github.com/phonegap/node-phonegap-soundwave",

@@ -6,0 +6,0 @@ "repository": {

@@ -7,4 +7,15 @@ <script type="text/javascript">

function checkForReload() {
function postStatus(){
var xhr = new XMLHttpRequest;
xhr.open('post', 'http://' + document.location.host + '/autoreload', false);
xhr.setRequestHeader('X-Requested-With','XMLHttpRequest');
xhr.onreadystatechange = function() {
if (this.readyState === 4 && /^[2]/.test(this.status)) {
}
}
xhr.send();
}
function checkForReload(){
var xhr = new XMLHttpRequest;
xhr.open('get', 'http://' + document.location.host + '/autoreload', true);

@@ -16,2 +27,3 @@ xhr.setRequestHeader('X-Requested-With','XMLHttpRequest');

if (response.outdated) {
postStatus();
window.location.reload();

@@ -18,0 +30,0 @@ }

@@ -7,69 +7,8 @@ <script type="text/javascript">

function loadConfig(callback) {
readFile('config.json', function(e, text) {
var config = parseAsJSON(text);
callback(e, config);
});
}
function parseAsJSON(text) {
try {
return JSON.parse(text);
} catch(e) {
return {};
}
}
function readFile(filepath, callback) {
window.requestFileSystem(
LocalFileSystem.PERSISTENT,
0,
function(fileSystem) {
fileSystem.root.getFile(
filepath,
null,
function gotFileEntry(fileEntry) {
fileEntry.file(
function gotFile(file){
var reader = new FileReader();
reader.onloadend = function(evt) {
callback(null, evt.target.result); // text
};
reader.readAsText(file);
},
function(error) {
callback(error);
}
);
},
function(error) {
callback(error);
}
);
},
function(error) {
callback(error);
}
);
}
function ontouchstart(event){
if (event.gesture.touches.length === 3) {
Hammer(document.body).off('touch', ontouchstart, false);
loadConfig(function(e, config) {
//
// bug: security prevents us from navigating to the file URL
//
//if (config.address) {
// window.location = config.URL;
//}
//else {
// address not saved, try fallback approach
window.history.back(window.history.length);
//}
});
window.history.back(window.history.length);
}
}
Hammer(document.body).on('touch', ontouchstart, false);

@@ -76,0 +15,0 @@

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