[go: nahoru, domu]

Skip to content

Commit

Permalink
Uncomment ES6 module syntax
Browse files Browse the repository at this point in the history
This removes the special comment part of the ES6 module syntax,
opting to enable ES6 module syntax by default.

It also appends `.js` to all import paths to better support in-browser
loading.
  • Loading branch information
DirectXMan12 committed Feb 26, 2017
1 parent d55e454 commit 3ae0bb0
Show file tree
Hide file tree
Showing 13 changed files with 43 additions and 62 deletions.
28 changes: 8 additions & 20 deletions app/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,12 @@
/* jslint white: false, browser: true */
/* global window, document.getElementById, Util, WebUtil, RFB, Display */

/* [module]
* import Util from "../core/util";
* import KeyTable from "../core/input/keysym";
* import keysyms from "../core/input/keysymdef";
* import RFB from "../core/rfb";
* import Display from "../core/display";
* import WebUtil from "./webutil";
*/
import Util from "../core/util.js";
import KeyTable from "../core/input/keysym.js";
import keysyms from "../core/input/keysymdef.js";
import RFB from "../core/rfb.js";
import Display from "../core/display.js";
import WebUtil from "./webutil.js";

var UI;

Expand Down Expand Up @@ -73,16 +71,6 @@ var UI;
{'app': ["locale/" + Util.Localisation.language + ".js"]});
}

/* [begin skip-as-module] */
// Load supporting scripts
WebUtil.load_scripts(
{'core': ["base64.js", "websock.js", "des.js", "input/keysymdef.js",
"input/xtscancodes.js", "input/util.js", "input/devices.js",
"display.js", "inflator.js", "rfb.js", "input/keysym.js"]});

window.onscriptsload = function () { UI.load(); };
/* [end skip-as-module] */

var _ = Util.Localisation.get;

UI = {
Expand Down Expand Up @@ -1755,7 +1743,7 @@ var UI;
*/
};

/* [module] UI.load(); */
UI.load();
})();

/* [module] export default UI; */
export default UI;
6 changes: 2 additions & 4 deletions app/webutil.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
/*jslint bitwise: false, white: false, browser: true, devel: true */
/*global Util, window, document */

/* [module]
* import Util from "../core/util";
*/
import Util from "../core/util.js";

// Globals defined here
var WebUtil = {};
Expand Down Expand Up @@ -308,4 +306,4 @@ WebUtil.load_scripts = function (files_by_dir) {
}
};

/* [module] export default WebUtil; */
export default WebUtil;
2 changes: 1 addition & 1 deletion core/base64.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,4 @@ var Base64 = {
}
}; /* End of Base64 namespace */

/* [module] export default Base64; */
export default Base64;
2 changes: 1 addition & 1 deletion core/des.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@

/* jslint white: false */

/* [module] export default */ function DES(passwd) {
export default function DES(passwd) {
"use strict";

// Tables, permutations, S-boxes, etc.
Expand Down
9 changes: 4 additions & 5 deletions core/display.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@
/*jslint browser: true, white: false */
/*global Util, Base64, changeCursor */

/* [module]
* import Util from "./util";
* import Base64 from "./base64";
*/
import Util from "./util.js";
import Base64 from "./base64.js";


/* [module] export default */ function Display(defaults) {
export default function Display(defaults) {
this._drawCtx = null;
this._c_forceCanvas = false;

Expand Down
11 changes: 5 additions & 6 deletions core/input/devices.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@
/*jslint browser: true, white: false */
/*global window, Util */

/* [module]
* import Util from "../util";
* import KeyboardUtil from "./util";
*/
import Util from "../util.js";
import KeyboardUtil from "./util.js";


/* [module] export */ var Keyboard;
export var Keyboard;

(function () {
"use strict";
Expand Down Expand Up @@ -148,7 +147,7 @@
]);
})();

/* [module] export */ var Mouse;
export var Mouse;

(function () {
Mouse = function (defaults) {
Expand Down
2 changes: 1 addition & 1 deletion core/input/keysym.js
Original file line number Diff line number Diff line change
Expand Up @@ -379,4 +379,4 @@ var KeyTable = {
XK_ydiaeresis: 0x00ff, /* U+00FF LATIN SMALL LETTER Y WITH DIAERESIS */
};

/* [module] export default KeyTable; */
export default KeyTable;
2 changes: 1 addition & 1 deletion core/input/keysymdef.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 4 additions & 5 deletions core/input/util.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* [module]
* import KeyTable from "./keysym";
* import keysyms from "./keysymdef";
*/
import KeyTable from "./keysym.js";
import keysyms from "./keysymdef.js";


var KeyboardUtil = {};

Expand Down Expand Up @@ -676,4 +675,4 @@ KeyboardUtil.EscapeModifiers = function(next) {
};
};

/* [module] export default KeyboardUtil; */
export default KeyboardUtil;
2 changes: 1 addition & 1 deletion core/input/xtscancodes.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,4 +148,4 @@ var XtScancode = {
"MediaSelect": 0xE06D,
};

/* [module] export default XtScancode */
export default XtScancode
23 changes: 11 additions & 12 deletions core/rfb.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,20 @@
* (c) 2012 Michael Tinglof, Joe Balaz, Les Piech (Mercuri.ca)
*/

/* [module]
* import Util from "./util";
* import Display from "./display";
* import { Keyboard, Mouse } from "./input/devices"
* import Websock from "./websock"
* import Base64 from "./base64";
* import DES from "./des";
* import KeyTable from "./input/keysym";
* import XtScancode from "./input/xtscancodes";
* import Inflator from "./inflator.mod";
*/
import Util from "./util.js";
import Display from "./display.js";
import { Keyboard, Mouse } from "./input/devices.js";
import Websock from "./websock.js";
import Base64 from "./base64.js";
import DES from "./des.js";
import KeyTable from "./input/keysym.js";
import XtScancode from "./input/xtscancodes.js";
import Inflator from "./inflator.mod.js";

/*jslint white: false, browser: true */
/*global window, Util, Display, Keyboard, Mouse, Websock, Websock_native, Base64, DES, KeyTable, Inflator, XtScancode */

/* [module] export default */ function RFB(defaults) {
export default function RFB(defaults) {
"use strict";
if (!defaults) {
defaults = {};
Expand Down
2 changes: 1 addition & 1 deletion core/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -618,4 +618,4 @@ Util.releaseCapture = function () {
}
};

/* [module] export default Util; */
export default Util;
7 changes: 3 additions & 4 deletions core/websock.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,13 @@
* read binary data off of the receive queue.
*/

/* [module]
* import Util from "./util";
*/
import Util from "./util.js";


/*jslint browser: true, bitwise: true */
/*global Util*/

/* [module] export default */ function Websock() {
export default function Websock() {
"use strict";

this._websocket = null; // WebSocket object
Expand Down

0 comments on commit 3ae0bb0

Please sign in to comment.