Merge branch 'master' into gh-pages

This commit is contained in:
Jeff Parsons 2017-01-02 15:17:56 -08:00
commit a7f9667b55
24 changed files with 1070 additions and 915 deletions

View file

@ -33,7 +33,6 @@ if (NODE) {
var http = require("http");
var path = require("path");
var url = require("url");
var Str = require("../../shared/es6/strlib");
}
class Net {

View file

@ -28,9 +28,11 @@
"use strict";
var Str = require("../../shared/es6/strlib");
var Web = require("../../shared/es6/weblib");
var Component = require("../../shared/es6/component");
if (NODE) {
var Str = require("../../shared/es6/strlib");
var Web = require("../../shared/es6/weblib");
var Component = require("../../shared/es6/component");
}
/**
* savePC(idMachine, sPCJSFile, callback)

View file

@ -28,8 +28,10 @@
"use strict";
var Web = require("../../shared/es6/weblib");
var Component = require("../../shared/es6/component");
if (NODE) {
var Web = require("../../shared/es6/weblib");
var Component = require("../../shared/es6/component");
}
class State {
/**

View file

@ -341,7 +341,19 @@ net.getResource = function(sURL, dataPost, fAsync, done)
var nErrorCode = -1, sResource = null, response = null;
if (net.isRemote(sURL)) {
console.log('net.getResource("' + sURL + '"): unimplemented');
/*
* TODO: This code is nothing more than a band-aid. It assumes the URL uses "http:"
* (hence the call to getFile(), which only supports HTTP GET operations), it assumes
* the requested data is UTF-8 string data (which is normally the case, because nearly
* all our requests are for JSON files), it doesn't deal with dataPost, it assumes
* that fAsync is true, and it performs very simplistic error code mapping.
*
* But, it gets the job done for what little we actually ask of it, when our machines
* are running in the Node environment.
*/
Net.getFile(sURL, "utf8", function(err, status, data) {
if (done) done(sURL, data, err? status : 0);
});
} else {
if (!sServerRoot) {
sServerRoot = path.join(path.dirname(fs.realpathSync(__filename)), "../../../");