mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
change require() to window.require() so compiler does not report errors.
This commit is contained in:
parent
932974d744
commit
0ec3787fc4
@ -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;
|
||||
}
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user