From 14af1fd8d18f45edaaf0055d75e31f462a1f02c2 Mon Sep 17 00:00:00 2001 From: Falk Werner Date: Wed, 13 Feb 2019 21:09:43 +0100 Subject: [PATCH] fixed some code style issues --- example/www/js/connection.js | 4 ++-- example/www/js/connection_view.js | 22 +++++++++++----------- example/www/js/filesystem.js | 16 ++++++++-------- example/www/js/filesystem_handler.js | 2 +- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/example/www/js/connection.js b/example/www/js/connection.js index 74b45db..1f4117c 100644 --- a/example/www/js/connection.js +++ b/example/www/js/connection.js @@ -11,10 +11,10 @@ class Connection { connectTo(url) { if (this.ws) { this.close(); } - this.ws = new WebSocket(url, 'fs'); + this.ws = new WebSocket(url, "fs"); this.ws.onopen = () => { this.isConnected = true; - this.onopen() + this.onopen(); }; this.ws.onclose = () => { this.isConnected = false; diff --git a/example/www/js/connection_view.js b/example/www/js/connection_view.js index 0dedafb..34e4e66 100644 --- a/example/www/js/connection_view.js +++ b/example/www/js/connection_view.js @@ -4,21 +4,21 @@ class ConnectionView { this.connection.onclose = () => { this.onConnectionClosed(); }; this.connection.onopen = () => { this.onConnectionOpened(); }; - this.element = document.createElement('div'); + this.element = document.createElement("div"); - let urlLabel = document.createElement('span'); - urlLabel.textContent = 'URL:'; + let urlLabel = document.createElement("span"); + urlLabel.textContent = "URL:"; this.element.appendChild(urlLabel); - this.urlTextbox = document.createElement('input'); - this.urlTextbox.type = 'text'; + this.urlTextbox = document.createElement("input"); + this.urlTextbox.type = "text"; this.urlTextbox.value = window.location.href.replace(/^http/, "ws"); this.element.appendChild(this.urlTextbox); - this.connectButton = document.createElement('input'); - this.connectButton.type = 'button'; - this.connectButton.value = 'connect'; - this.connectButton.addEventListener('click', () => { this.onConnectButtonClicked(); }); + this.connectButton = document.createElement("input"); + this.connectButton.type = "button"; + this.connectButton.value = "connect"; + this.connectButton.addEventListener("click", () => { this.onConnectButtonClicked(); }); this.element.appendChild(this.connectButton); } @@ -32,11 +32,11 @@ class ConnectionView { } } onConnectionOpened() { - this.connectButton.value = 'disconnect'; + this.connectButton.value = "disconnect"; } onConnectionClosed() { - this.connectButton.value = 'connect'; + this.connectButton.value = "connect"; } } diff --git a/example/www/js/filesystem.js b/example/www/js/filesystem.js index 034a8ff..3c122db 100644 --- a/example/www/js/filesystem.js +++ b/example/www/js/filesystem.js @@ -44,7 +44,7 @@ class FileSystem { return { inode: entry.inode, mode: entry.mode || parseInt("755", 8), - type: entry.type || 'file', + type: entry.type || "file", size: entry.size || (entry.contents && entry.contents.length) || 0, atime: entry.atime || 0, mtime: entry.mtime || 0, @@ -62,7 +62,7 @@ class FileSystem { if (entry) { return { mode: entry.mode || parseInt("755", 8), - type: entry.type || 'file', + type: entry.type || "file", size: entry.size || (entry.contents && entry.contents.length) || 0, atime: entry.atime || 0, mtime: entry.mtime || 0, @@ -80,13 +80,13 @@ class FileSystem { if ((entry) && ("dir" === entry.type)) { result = [ - {name: '.', inode: entry.inode}, - {name: '..', inode: entry.inode} + {name: ".", inode: entry.inode}, + {name: "..", inode: entry.inode} ]; for(let subdir of Object.entries(entry.entries)) { const name = subdir[0]; const inode = subdir[1].inode; - result.push({name: name, inode: inode}); + result.push({name, inode}); } } @@ -97,8 +97,8 @@ class FileSystem { let result = FileSystem.BAD_NOENTRY; let entry = this._inodes[inode]; - if (entry.type == "file") { - result = ((mode & FileSystem.O_ACCMODE) == FileSystem.O_RDONLY) ? {handle: 1337} : FileSystem.BAD_NOACCESS; + if (entry.type === "file") { + result = ((mode & FileSystem.O_ACCMODE) === FileSystem.O_RDONLY) ? {handle: 1337} : FileSystem.BAD_NOACCESS; } return result; @@ -113,7 +113,7 @@ class FileSystem { let result = FileSystem.BAD_NOENTRY; let entry = this._inodes[inode]; - if (entry.type == "file") { + if (entry.type === "file") { let end = Math.min(offset + length, entry.contents.length); let data = (offset < entry.contents.length) ? entry.contents.substring(offset, end) : ""; result = { diff --git a/example/www/js/filesystem_handler.js b/example/www/js/filesystem_handler.js index 540a8af..ff3aadf 100644 --- a/example/www/js/filesystem_handler.js +++ b/example/www/js/filesystem_handler.js @@ -83,5 +83,5 @@ class FileSystemHandler { } } catch (ex) { console.log(ex, message); } - }; + } }