mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-28 18:00:09 +00:00
60 lines
1.5 KiB
Plaintext
Executable File
60 lines
1.5 KiB
Plaintext
Executable File
|
|
Modules and RequireJS
|
|
=====================
|
|
|
|
Most of the system is loaded via browser context RequireJS loader, in
|
|
node/electron/nw context node-specific stuff is loaded with a second
|
|
node-enabled RequireJS instance or node require.
|
|
|
|
The ideal solution would be to use one require that sees both the browser
|
|
and node contexts, the problem is exactly in this, the browser requirejs
|
|
does not see either node or node modules while the node require loads code
|
|
that is not visible to devtools unless it is running at that exact moment.
|
|
|
|
Thus we are forced to use both mode requirejs loaders which may be
|
|
confusing at times.
|
|
|
|
|
|
Different loaders
|
|
-----------------
|
|
|
|
There are two RequireJS instances present in most contexts in nw.js
|
|
within the define(..) runner:
|
|
- require(..)
|
|
Pure browser RequireJS instance, used to load local
|
|
modules.
|
|
|
|
- requirejs(..)
|
|
Node-enabled RequireJS instance, used to load node
|
|
modules.
|
|
This is needed as the above require(..) overloads the
|
|
node native loader.
|
|
|
|
The future
|
|
----------
|
|
|
|
This seems a bit confusing, so at least the naming convention should be
|
|
revised.
|
|
|
|
|
|
Entry points
|
|
============
|
|
|
|
The current state of things is far from optimal -- we have "three"
|
|
"different" entry points:
|
|
|
|
- index.html - Browser
|
|
- e.js - electron
|
|
-> electron.html - electron-specific html
|
|
- ig.js - node
|
|
-> e.js - node can spawn an electron app
|
|
|
|
|
|
The goal is to simplify this by merging the electron/node entry points
|
|
and merging the html files into one.
|
|
|
|
|
|
|
|
|
|
|