emscripten Humble Cloud interface
Edward Rudd
2014-08-20 9f20b24a0b1ba4462d1f01377cddbd6128a224d9

move cloud setup into shell instead of in the humble_cloud library

3 files modified
32 ■■■■■ changed files
client/library/humble_cloud.h 2 ●●●●● patch | view | raw | blame | history
client/library/humble_cloud.js 17 ●●●●● patch | view | raw | blame | history
client/test/shell.html 13 ●●●●● patch | view | raw | blame | history
client/library/humble_cloud.h
@@ -7,6 +7,8 @@
    bool humble_cloud_init();
    void humble_cloud_sync();
#ifdef __cplusplus
};
#endif
client/library/humble_cloud.js
@@ -1,18 +1,8 @@
var LibraryHUMBLE_CLOUD = {
    $HUMBLE_CLOUD__deps: ['$FS', '$MEMFS', '$PATH'],
    $HUMBLE_CLOUD__postset: 'HUMBLE_CLOUD.staticInit()',
    $HUMBLE_CLOUD: {
        applicationToken: '__NOTOKEN__',
        remoteAPIEndpoint: 'http://asmjs.brigadoon.outoforder.cc/cloud',
        staticInit: function() {
            console.log('Humble Cloud Init');
            addRunDependency('HUMBLE_CLOUD');
            FS.createFolder('/', 'user_cloud', true, true);
            FS.mount(HUMBLE_CLOUD, {}, '/user_cloud');
            console.log('Doing stuff to synchronize files');
            removeRunDependency('HUMBLE_CLOUD');
        },
        mount: function(mount) {
            console.log("Mounting", mount);
@@ -116,7 +106,7 @@
                          };
                      }
                      prefix = p;
                  })
                  });
              }
              var p = toAbsolute(f.path);
              entries[p] = {
@@ -134,6 +124,11 @@
    },
    humble_cloud_init: function() {
        // Dummy function to pull in the rest of the functions
    },
    humble_cloud_sync: function() {
        FS.syncfs(function(err) {
            console.log('File Sync');
        });
    }
};
client/test/shell.html
@@ -1296,8 +1296,21 @@
        };
      };
      Module['preRun'].push(function() {
          addRunDependency('HUMBLE_CLOUD_setup');
          FS.createFolder('/', 'user_data', true, true);
          FS.mount(IDBFS, {}, '/user_data');
          FS.createFolder('/', 'user_cloud', true, true);
          FS.mount(HUMBLE_CLOUD, {
              endpoint: 'http://someawesomeserver/',
              applicationtoken: 'deadbeef'
          }, '/user_cloud');
          FS.syncfs(true, function(err) {
              if(err) console.log('ERROR!', err);
              console.log('finished syncing.. YEAH!!!');
              removeRunDependency('HUMBLE_CLOUD_setup');
          });
      });
      var test_functions = {};
      function call_test_function(func)