Just documentation

This commit is contained in:
Mitra Ardron 2018-05-05 21:10:15 -07:00
parent 317079a87d
commit 3c023c6c19
5 changed files with 8 additions and 7 deletions

1
API.md
View File

@ -369,6 +369,7 @@ Main connection process for a browser based application,
options { options {
transports Array of abbreviations of transports e.g. ["HTTP","IPFS"] as provided in URL transports Array of abbreviations of transports e.g. ["HTTP","IPFS"] as provided in URL
defaulttransports Array of abbreviations of transports to use if transports is unset defaulttransports Array of abbreviations of transports to use if transports is unset
paused Array of abbreviations of transports that should be paused (not started)
statuselement HTML element to build status display under statuselement HTML element to build status display under
... Entire options is passed to each setup0 and will include options for each Transport ... Entire options is passed to each setup0 and will include options for each Transport
} }

View File

@ -53,7 +53,7 @@ class Transport {
return t.p_setup2(verbose, cb); // And connect return t.p_setup2(verbose, cb); // And connect
} }
togglePaused(cb) { //TODO-API //TODO-SW move to Transports > TransportsProxy > UI togglePaused(cb) { //TODO-SW move to Transports > TransportsProxy > UI
/* /*
Switch the state of the transport between STATUS_CONNECTED and STATUS_PAUSED, Switch the state of the transport between STATUS_CONNECTED and STATUS_PAUSED,
in the paused state it will not be used for transport but, in some cases, will still do background tasks like serving files. in the paused state it will not be used for transport but, in some cases, will still do background tasks like serving files.

View File

@ -109,7 +109,7 @@ class TransportIPFS extends Transport {
return t; return t;
} }
async p_setup1(verbose, cb) { //TODO-API async p_setup1(verbose, cb) {
try { try {
if (verbose) console.log("IPFS starting and connecting"); if (verbose) console.log("IPFS starting and connecting");
this.status = Transport.STATUS_STARTING; // Should display, but probably not refreshed in most case this.status = Transport.STATUS_STARTING; // Should display, but probably not refreshed in most case
@ -309,7 +309,7 @@ class TransportIPFS extends Transport {
console.log(err.message); console.log(err.message);
} }
} }
async p_f_createReadStream(url, {verbose=false}={}) { // Asynchronously return a function that can be used in createReadStream TODO-API async p_f_createReadStream(url, {verbose=false}={}) { // Asynchronously return a function that can be used in createReadStream
verbose = true; verbose = true;
if (verbose) console.log("p_f_createReadStream",url); if (verbose) console.log("p_f_createReadStream",url);
const mh = TransportIPFS.multihashFrom(url); const mh = TransportIPFS.multihashFrom(url);

View File

@ -218,7 +218,7 @@ class TransportWEBTORRENT extends Transport {
} }
async p_f_createReadStream(url, {verbose=false, wanturl=false}={}) { //TODO-API async p_f_createReadStream(url, {verbose=false, wanturl=false}={}) {
/* /*
Fetch bytes progressively, using a node.js readable stream, based on a url of the form: Fetch bytes progressively, using a node.js readable stream, based on a url of the form:
No assumption is made about the data in terms of size or structure. No assumption is made about the data in terms of size or structure.

View File

@ -34,7 +34,7 @@ class Transports {
static async p_connectedNamesParm() { // Doesnt strictly need to be async, but for consistency with Proxy it has to be. static async p_connectedNamesParm() { // Doesnt strictly need to be async, but for consistency with Proxy it has to be.
return (await this.p_connectedNames()).map(n => "transport="+n).join('&') return (await this.p_connectedNames()).map(n => "transport="+n).join('&')
} }
static async p_statuses() { //TODO-API static async p_statuses() {
/* /*
resolves to: a dictionary of statuses of transports, e.g. { TransportHTTP: STATUS_CONNECTED } resolves to: a dictionary of statuses of transports, e.g. { TransportHTTP: STATUS_CONNECTED }
*/ */
@ -91,7 +91,7 @@ class Transports {
return urls; return urls;
} }
} }
static resolveNamesWith(cb) { //TODO-API static resolveNamesWith(cb) {
// Set a callback for p_resolveNames // Set a callback for p_resolveNames
this.namingcb = cb; this.namingcb = cb;
} }
@ -515,7 +515,7 @@ class Transports {
} }
} }
static async p_connect(options, verbose) { //TODO-API paused static async p_connect(options, verbose) {
/* /*
This is a standardish starting process, feel free to subclass or replace ! This is a standardish starting process, feel free to subclass or replace !
It will connect to a set of standard transports and is intended to work inside a browser. It will connect to a set of standard transports and is intended to work inside a browser.