Merge branch 'master' of github.com:jedmccaleb/NewCoin

This commit is contained in:
JoelKatz
2012-11-08 14:36:45 -08:00
2 changed files with 31 additions and 14 deletions

View File

@@ -385,15 +385,14 @@ Remote.prototype._connect_start = function () {
self._connect_retry();
};
// Node's ws module doesn't pass arguments to onmessage.
ws.on('message', function (json, flags) {
self._connect_message(ws, json, flags);
});
ws.onmessage = function (json) {
self._connect_message(ws, json.data);
};
};
// It is possible for messages to be dispatched after the connection is closed.
Remote.prototype._connect_message = function (ws, json, flags) {
Remote.prototype._connect_message = function (ws, json) {
var message = JSON.parse(json);
var unexpected = false;
var request;

View File

@@ -5,7 +5,13 @@ var extend = require("extend");
var programPath = __dirname + "/src/js/remote.js";
console.log('Compiling Ripple JavaScript...');
var watch = false;
process.argv.forEach(function (arg) {
if (arg === '-w' || arg === '--watch') {
watch = true;
}
});
var builds = [{
filename: 'ripple-'+pkg.version+'.js',
},{
@@ -20,8 +26,10 @@ var defaultOpts = {
// [sic] Yes, this is the spelling upstream.
libary: 'ripple',
// However, it's fixed in webpack 0.8, so we include the correct spelling too:
library: 'ripple'
library: 'ripple',
watch: watch
};
function build(opts) {
var opts = extend({}, defaultOpts, opts);
opts.output = __dirname + "/build/"+opts.filename;
@@ -29,13 +37,23 @@ function build(opts) {
var filename = opts.filename;
webpack(programPath, opts, function (err, result) {
console.log(' '+filename, result.hash, '['+result.modulesCount+']');
callback(err);
if ("function" === typeof callback) {
callback(err);
}
});
}
}
async.series(builds.map(build), function (err) {
if (err) {
console.error(err);
}
});
if (!watch) {
console.log('Compiling Ripple JavaScript...');
async.series(builds.map(build), function (err) {
if (err) {
console.error(err);
}
});
} else {
console.log('Watching files for changes...');
builds.map(build).forEach(function (build) {
build();
});
}