You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In javascript, it's very important to detect what features you have access to.
In the case of js2cpp, we don't have things like a window or a document or a global (not yet, for another issue). Unfortunately the c++ compiler doesn't allow us to compile if dead code calls something that doesn't exist.
If someone writes some isomorphic code which contains a feature detection, for example:
if (typeof location !== 'undefined') { location.reload(); }
We should remove the entire condition if this feature is not present.
A new option, which lists what is defined in the global scope, should be defined. Early returns such as
if (typeof location !== 'undefined') { return; }
// use location...
should also remove the code that follows them.
The text was updated successfully, but these errors were encountered:
In javascript, it's very important to detect what features you have access to.
In the case of js2cpp, we don't have things like a
window
or adocument
or aglobal
(not yet, for another issue). Unfortunately the c++ compiler doesn't allow us to compile if dead code calls something that doesn't exist.If someone writes some isomorphic code which contains a feature detection, for example:
We should remove the entire condition if this feature is not present.
A new option, which lists what is defined in the global scope, should be defined. Early returns such as
should also remove the code that follows them.
The text was updated successfully, but these errors were encountered: