Skip to content

Commit

Permalink
Clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
tentone committed Apr 26, 2023
1 parent 5c8efdd commit ae40fe1
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 20 deletions.
26 changes: 13 additions & 13 deletions source/core/FileSystem.js
Expand Up @@ -18,7 +18,7 @@ function FileSystem() {}

try
{
FileSystem.fs = window.require("fs");
FileSystem.fs = window.require ? window.require("fs") : null;
}
catch (e) {}

Expand Down Expand Up @@ -54,7 +54,7 @@ FileSystem.readFile = function(fname, sync, onLoad, onProgress, onError)
}

// NodeJS
if (FileSystem.fs !== undefined && FileSystem.isLocalFile(fname))
if (FileSystem.fs && FileSystem.isLocalFile(fname))
{
if (sync === true)
{
Expand Down Expand Up @@ -138,7 +138,7 @@ FileSystem.readFileArrayBuffer = function(fname, sync, onLoad, onProgress, onErr
}

// NodeJS
if (FileSystem.fs !== undefined && FileSystem.isLocalFile(fname))
if (FileSystem.fs && FileSystem.isLocalFile(fname))
{
if (sync === true)
{
Expand Down Expand Up @@ -216,7 +216,7 @@ FileSystem.readFileBase64 = function(fname, sync, onLoad, onProgress, onError)
}

// NodeJS
if (FileSystem.fs !== undefined && FileSystem.isLocalFile(fname))
if (FileSystem.fs && FileSystem.isLocalFile(fname))
{
if (sync === true)
{
Expand Down Expand Up @@ -285,7 +285,7 @@ FileSystem.readFileBase64 = function(fname, sync, onLoad, onProgress, onError)
*/
FileSystem.writeFile = function(fname, data, sync, onFinish)
{
if (FileSystem.fs !== undefined)
if (FileSystem.fs)
{
if (FileSystem.fs.writeFileSync !== undefined)
{
Expand Down Expand Up @@ -344,7 +344,7 @@ FileSystem.writeFile = function(fname, data, sync, onFinish)
*/
FileSystem.writeFileBase64 = function(fname, data, sync, onFinish)
{
if (FileSystem.fs !== undefined)
if (FileSystem.fs)
{
var buffer = Buffer.from(Base64Utils.removeHeader(data), "base64");

Expand Down Expand Up @@ -407,7 +407,7 @@ FileSystem.writeFileBase64 = function(fname, data, sync, onFinish)
*/
FileSystem.writeFileArrayBuffer = function(fname, data, sync, onFinish)
{
if (FileSystem.fs !== undefined)
if (FileSystem.fs)
{
var buffer = BufferUtils.fromArrayBuffer(data);

Expand Down Expand Up @@ -602,7 +602,7 @@ FileSystem.chooseFileName = function(onLoad, saveas, name)
*/
FileSystem.copyFile = function(src, dst)
{
if (FileSystem.fs !== undefined)
if (FileSystem.fs)
{
if (FileSystem.fs.copyFileSync !== undefined)
{
Expand All @@ -628,7 +628,7 @@ FileSystem.copyFile = function(src, dst)
*/
FileSystem.makeDirectory = function(dir)
{
if (FileSystem.fs !== undefined)
if (FileSystem.fs)
{
dir.replace(new RegExp("/", 'g'), "\\");
FileSystem.fs.mkdirSync(dir, {recursive: true});
Expand All @@ -645,7 +645,7 @@ FileSystem.makeDirectory = function(dir)
*/
FileSystem.getFilesDirectory = function(dir)
{
if (FileSystem.fs !== undefined)
if (FileSystem.fs)
{
try
{
Expand All @@ -671,7 +671,7 @@ FileSystem.getFilesDirectory = function(dir)
*/
FileSystem.deleteFolder = function(path)
{
if (FileSystem.fs !== undefined)
if (FileSystem.fs)
{
if (FileSystem.fs.existsSync(path))
{
Expand Down Expand Up @@ -705,7 +705,7 @@ FileSystem.deleteFolder = function(path)
*/
FileSystem.copyFolder = function(src, dst)
{
if (FileSystem.fs !== undefined)
if (FileSystem.fs)
{
src.replace(new RegExp("/", 'g'), "\\");
dst.replace(new RegExp("/", 'g'), "\\");
Expand Down Expand Up @@ -749,7 +749,7 @@ FileSystem.copyFolder = function(src, dst)
*/
FileSystem.fileExists = function(file)
{
if (FileSystem.fs !== undefined)
if (FileSystem.fs)
{
file.replace(new RegExp("/", 'g'), "\\");

Expand Down
3 changes: 0 additions & 3 deletions source/core/loaders/TextureLoader.js
Expand Up @@ -268,9 +268,6 @@ TextureLoader.prototype.parse = function(json, onLoad)
// SpriteSheet texture
if (category === "SpriteSheet")
{
// TODO <REMOVE THIS>
console.log(this.images[json.image], json.framesHorizontal, json.framesVertical, json.totalFrames);

texture = new SpriteSheetTexture(this.images[json.image], json.framesHorizontal, json.framesVertical, json.totalFrames);
texture.loop = json.loop;
texture.animationSpeed = json.animationSpeed;
Expand Down
2 changes: 2 additions & 0 deletions source/editor/Main.js
Expand Up @@ -11,3 +11,5 @@ GLSL(CodeMirror);

document.body.onload = Editor.initialize;
document.body.onresize = Editor.resize;

window.Buffer = window.ArrayBuffer;
1 change: 0 additions & 1 deletion source/editor/components/dropdown/DropdownMenu.js
Expand Up @@ -264,7 +264,6 @@ DropdownMenu.prototype.setExpanded = function(expanded)
this.panel.element.style.left = this.position.x + "px";

var out = DOMUtils.checkBorder(this.panel.element);
console.log(out);
if (out.y !== 0)
{
this.panel.element.style.top = null;
Expand Down
2 changes: 0 additions & 2 deletions source/editor/gui/form-snippet/LightShadowFormSnippet.js
Expand Up @@ -155,8 +155,6 @@ LightShadowFormSnippet.prototype = Object.create(FormSnippet.prototype);

LightShadowFormSnippet.prototype.updateValues = function()
{
console.log(this.object);

this.bias.setValue(this.object.shadow.bias);
this.radius.setValue(this.object.shadow.radius);
this.width.setValue(this.object.shadow.mapSize.width);
Expand Down
2 changes: 1 addition & 1 deletion webpack.dev.js
Expand Up @@ -8,9 +8,9 @@ const common = require("./webpack.config.js");

module.exports = [
merge(common[0], {
devtool: false,
mode: "development",
optimization: {minimize: false},
devtool: 'inline-source-map',
performance: {
hints: false,
},
Expand Down

0 comments on commit ae40fe1

Please sign in to comment.