setup.js
async function p_setup() {
    try {
        //SEE-OTHER-ADDTRANSPORT - note these are options just for testing that override default options for the transport.
        let opts = {
            //http: {urlbase: "http://localhost:4244"},   // Localhost - comment out if want to use dweb.me (default args use this)
            yjs: {db: {name: "leveldb", dir: "../leveldb_dweb", connector: {}}},  // cleanStart: true  clears db so dont use that
            webtorrent: {}
        }; // Note browser requires indexeddb

        // Note the order of these is significant, it will retrieve by preference from the first setup, try with both orders if in doubt.
        //SEE-OTHER-ADDTRANSPORT
        //TODO-REQUIRE these will break
        //let t_ipfs = await DwebTransports._transportclasses["IPFS"].p_setup(opts); await t_ipfs.p_status(); // Note browser requires indexeddb
        //let t_yjs = await DwebTransports._transportclasses["YJS"].p_setup(opts);  await t_yjs.p_status(); // Should find ipfs transport
        let t_http = await DwebTransports._transportclasses["HTTP"].p_setup(opts); await t_http.p_status();
        //let t_webtorrent = await TransportWEBTORRENT.p_test(opts); await t_webtorrent.p_status();
        console.log("setup returned and transport(s) connected:", await DwebTransports.p_connectedNames());
        await Domain.p_setupOnce();
    } catch (err) {
        console.log("Test failed", err);
    }

}
async function p_setup() {
    try {
        //SEE-OTHER-ADDTRANSPORT - note these are options just for testing that override default options for the transport.
        let opts = {
            //http: {urlbase: "http://localhost:4244"},   // Localhost - comment out if want to use dweb.me (default args use this)
            yjs: {db: {name: "leveldb", dir: "../leveldb_dweb", connector: {}}},  // cleanStart: true  clears db so dont use that
            webtorrent: {}
        }; // Note browser requires indexeddb

        // Note the order of these is significant, it will retrieve by preference from the first setup, try with both orders if in doubt.
        //SEE-OTHER-ADDTRANSPORT
        //TODO-REQUIRE these will break
        //let t_ipfs = await DwebTransports._transportclasses["IPFS"].p_setup(opts); await t_ipfs.p_status(); // Note browser requires indexeddb
        //let t_yjs = await DwebTransports._transportclasses["YJS"].p_setup(opts);  await t_yjs.p_status(); // Should find ipfs transport
        let t_http = await DwebTransports._transportclasses["HTTP"].p_setup(opts); await t_http.p_status();
        //let t_webtorrent = await TransportWEBTORRENT.p_test(opts); await t_webtorrent.p_status();
        console.log("setup returned and transport(s) connected:", await DwebTransports.p_connectedNames());
        await Domain.p_setupOnce();
    } catch (err) {
        console.log("Test failed", err);
    }

}
async function p_setup ( ) { try { //SEE-OTHER-ADDTRANSPORT - note these are options just for testing that override default options for the transport. let opts = { //http: {urlbase: "http://localhost:4244"},   // Localhost - comment out if want to use dweb.me (default args use this) yjs : { db : { name : "leveldb" , dir : "../leveldb_dweb" , connector : { } } } , // cleanStart: true  clears db so dont use that webtorrent : { } } ; // Note browser requires indexeddb // Note the order of these is significant, it will retrieve by preference from the first setup, try with both orders if in doubt. //SEE-OTHER-ADDTRANSPORT //TODO-REQUIRE these will break //let t_ipfs = await DwebTransports._transportclasses["IPFS"].p_setup(opts); await t_ipfs.p_status(); // Note browser requires indexeddb //let t_yjs = await DwebTransports._transportclasses["YJS"].p_setup(opts);  await t_yjs.p_status(); // Should find ipfs transport let t_http = await DwebTransports . _transportclasses [ "HTTP" ] . p_setup ( opts ) ; await t_http . p_status ( ) ; //let t_webtorrent = await TransportWEBTORRENT.p_test(opts); await t_webtorrent.p_status(); console . log ( "setup returned and transport(s) connected:" , await DwebTransports . p_connectedNames ( ) ) ; await Domain . p_setupOnce ( ) ; } catch ( err ) { console . log ( "Test failed" , err ) ; } }
require('y-leveldb')(DwebTransports._transportclasses["YJS"].Y); //- can't be there for browser, node seems to find it ok without this and auto-loads with a warning. Note that this test setup is being mirror in test_ipfs.html In general it should be possible to comment out failing tests EXCEPT where they provide a value to the next
require ( y - leveldb ) ( DwebTransports . _transportclasses [ YJS ] . Y ) ; // - can t be there for browser node seems to find it ok without this and auto - loads with a warning . Note that this test setup is being mirror in test_ipfs . html In general it should be possible to comment out failing tests EXCEPT where they provide a value to the next