change require() to window.require() so compiler does not report errors.

This commit is contained in:
Lee Grey 2015-03-25 18:36:55 +13:00
parent 932974d744
commit 0ec3787fc4
2 changed files with 4 additions and 4 deletions

View File

@ -9,11 +9,11 @@
ns.Environment = {
detectNodeWebkit : function () {
var isNode = (typeof process !== "undefined" && typeof require !== "undefined");
var isNode = (typeof window.process !== "undefined" && typeof window.require !== "undefined");
var isNodeWebkit = false;
if (isNode) {
try {
isNodeWebkit = (typeof require('nw.gui') !== "undefined");
isNodeWebkit = (typeof window.require('nw.gui') !== "undefined");
} catch (e) {
isNodeWebkit = false;
}

View File

@ -59,7 +59,7 @@
* @callback callback
*/
saveToFile : function(content, filename, callback) {
var fs = require('fs');
var fs = window.require('fs');
fs.writeFile(filename, content, function(err){
if (err) {
//throw err;
@ -70,7 +70,7 @@
},
readFile : function(filename, callback) {
var fs = require('fs');
var fs = window.require('fs');
// NOTE: currently loading everything as utf8, which may not be desirable in future
fs.readFile(filename, 'utf8', function(err, data){
if (err) {