In rpg_core.js we can find a function named Utils.isNwjs,which means to distinguish if your JS environment be NWJS.
However ,this function is built in a wrong way.
It arbitrarily thought every JS environment which has similar implementation to be NWJS.
Most time it runs rightly,but it CAN BE ABLE TO recognize some environment as NWJS,for example,Electron.
So I recommend everyone who wants more robustness to rewrite this code like this:
This is so-called Duck Typing.
However ,this function is built in a wrong way.
HTML:
/**
* Checks whether the platform is NW.js.
*
* @static
* @method isNwjs
* @return {Boolean} True if the platform is NW.js
*/
Utils.isNwjs = function() {
return typeof require === 'function' && typeof process === 'object';
};
Most time it runs rightly,but it CAN BE ABLE TO recognize some environment as NWJS,for example,Electron.
So I recommend everyone who wants more robustness to rewrite this code like this:
HTML:
/**
* Checks whether the platform is NW.js.
*
* @static
* @method isNwjs
* @return {Boolean} True if the platform is NW.js
*/
Utils.isNwjs = function() {
try{
var tmp = require("nw.gui");
}catch(err){
return false;
}
return typeof require === 'function' && typeof process === 'object';
};