In case I was not clear above ... in emscripten/src/shell.js, the following 
test sets the environment to web or node:

ENVIRONMENT_IS_WEB = typeof window === 'object';
ENVIRONMENT_IS_WORKER = typeof importScripts === 'function';
ENVIRONMENT_IS_NODE = typeof process === 'object' && typeof require === 
'function' && !ENVIRONMENT_IS_WEB && !ENVIRONMENT_IS_WORKER;

So once web is detected, node cannot be set. In particular, an Electron web 
page contains "window" of type "object" and therefore the environment is 
set to "web", even if node has been enabled within that web page. 

As a result, it is not possible to mount the NODEFS file system, even 
though node is present to do so. Failure takes place in mount() at the 
assertion in src/library_nodefs.js:

    mount: function (mount) {
      assert(ENVIRONMENT_IS_NODE);
      return NODEFS.createNode(null, '/', NODEFS.getMode(mount.opts.root), 
0);
    },

Is there a reason why once the web environment is detected, it cannot be 
reset to node, if node features are present?

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/emscripten-discuss/8c683ced-51f1-4062-97d3-ad3f4c8017b3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to