Uncomment ES6 module syntax

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.
This commit is contained in:
Solly Ross 2017-02-03 23:17:44 -05:00
parent d55e454582
commit 3ae0bb0968
13 changed files with 43 additions and 62 deletions

View File

@ -11,14 +11,12 @@
/* jslint white: false, browser: true */ /* jslint white: false, browser: true */
/* global window, document.getElementById, Util, WebUtil, RFB, Display */ /* global window, document.getElementById, Util, WebUtil, RFB, Display */
/* [module] import Util from "../core/util.js";
* import Util from "../core/util"; import KeyTable from "../core/input/keysym.js";
* import KeyTable from "../core/input/keysym"; import keysyms from "../core/input/keysymdef.js";
* import keysyms from "../core/input/keysymdef"; import RFB from "../core/rfb.js";
* import RFB from "../core/rfb"; import Display from "../core/display.js";
* import Display from "../core/display"; import WebUtil from "./webutil.js";
* import WebUtil from "./webutil";
*/
var UI; var UI;
@ -73,16 +71,6 @@ var UI;
{'app': ["locale/" + Util.Localisation.language + ".js"]}); {'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; var _ = Util.Localisation.get;
UI = { UI = {
@ -1755,7 +1743,7 @@ var UI;
*/ */
}; };
/* [module] UI.load(); */ UI.load();
})(); })();
/* [module] export default UI; */ export default UI;

View File

@ -10,9 +10,7 @@
/*jslint bitwise: false, white: false, browser: true, devel: true */ /*jslint bitwise: false, white: false, browser: true, devel: true */
/*global Util, window, document */ /*global Util, window, document */
/* [module] import Util from "../core/util.js";
* import Util from "../core/util";
*/
// Globals defined here // Globals defined here
var WebUtil = {}; var WebUtil = {};
@ -308,4 +306,4 @@ WebUtil.load_scripts = function (files_by_dir) {
} }
}; };
/* [module] export default WebUtil; */ export default WebUtil;

View File

@ -112,4 +112,4 @@ var Base64 = {
} }
}; /* End of Base64 namespace */ }; /* End of Base64 namespace */
/* [module] export default Base64; */ export default Base64;

View File

@ -77,7 +77,7 @@
/* jslint white: false */ /* jslint white: false */
/* [module] export default */ function DES(passwd) { export default function DES(passwd) {
"use strict"; "use strict";
// Tables, permutations, S-boxes, etc. // Tables, permutations, S-boxes, etc.

View File

@ -10,12 +10,11 @@
/*jslint browser: true, white: false */ /*jslint browser: true, white: false */
/*global Util, Base64, changeCursor */ /*global Util, Base64, changeCursor */
/* [module] import Util from "./util.js";
* import Util from "./util"; import Base64 from "./base64.js";
* import Base64 from "./base64";
*/
/* [module] export default */ function Display(defaults) {
export default function Display(defaults) {
this._drawCtx = null; this._drawCtx = null;
this._c_forceCanvas = false; this._c_forceCanvas = false;

View File

@ -8,12 +8,11 @@
/*jslint browser: true, white: false */ /*jslint browser: true, white: false */
/*global window, Util */ /*global window, Util */
/* [module] import Util from "../util.js";
* import Util from "../util"; import KeyboardUtil from "./util.js";
* import KeyboardUtil from "./util";
*/
/* [module] export */ var Keyboard;
export var Keyboard;
(function () { (function () {
"use strict"; "use strict";
@ -148,7 +147,7 @@
]); ]);
})(); })();
/* [module] export */ var Mouse; export var Mouse;
(function () { (function () {
Mouse = function (defaults) { Mouse = function (defaults) {

View File

@ -379,4 +379,4 @@ var KeyTable = {
XK_ydiaeresis: 0x00ff, /* U+00FF LATIN SMALL LETTER Y WITH DIAERESIS */ XK_ydiaeresis: 0x00ff, /* U+00FF LATIN SMALL LETTER Y WITH DIAERESIS */
}; };
/* [module] export default KeyTable; */ export default KeyTable;

View File

@ -21,4 +21,4 @@ var keysyms = (function(){
}; };
})(); })();
/* [module] export default keysyms */ export default keysyms

View File

@ -1,7 +1,6 @@
/* [module] import KeyTable from "./keysym.js";
* import KeyTable from "./keysym"; import keysyms from "./keysymdef.js";
* import keysyms from "./keysymdef";
*/
var KeyboardUtil = {}; var KeyboardUtil = {};
@ -676,4 +675,4 @@ KeyboardUtil.EscapeModifiers = function(next) {
}; };
}; };
/* [module] export default KeyboardUtil; */ export default KeyboardUtil;

View File

@ -148,4 +148,4 @@ var XtScancode = {
"MediaSelect": 0xE06D, "MediaSelect": 0xE06D,
}; };
/* [module] export default XtScancode */ export default XtScancode

View File

@ -10,21 +10,20 @@
* (c) 2012 Michael Tinglof, Joe Balaz, Les Piech (Mercuri.ca) * (c) 2012 Michael Tinglof, Joe Balaz, Les Piech (Mercuri.ca)
*/ */
/* [module] import Util from "./util.js";
* import Util from "./util"; import Display from "./display.js";
* import Display from "./display"; import { Keyboard, Mouse } from "./input/devices.js";
* import { Keyboard, Mouse } from "./input/devices" import Websock from "./websock.js";
* import Websock from "./websock" import Base64 from "./base64.js";
* import Base64 from "./base64"; import DES from "./des.js";
* import DES from "./des"; import KeyTable from "./input/keysym.js";
* import KeyTable from "./input/keysym"; import XtScancode from "./input/xtscancodes.js";
* import XtScancode from "./input/xtscancodes"; import Inflator from "./inflator.mod.js";
* import Inflator from "./inflator.mod";
*/
/*jslint white: false, browser: true */ /*jslint white: false, browser: true */
/*global window, Util, Display, Keyboard, Mouse, Websock, Websock_native, Base64, DES, KeyTable, Inflator, XtScancode */ /*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"; "use strict";
if (!defaults) { if (!defaults) {
defaults = {}; defaults = {};

View File

@ -618,4 +618,4 @@ Util.releaseCapture = function () {
} }
}; };
/* [module] export default Util; */ export default Util;

View File

@ -12,14 +12,13 @@
* read binary data off of the receive queue. * read binary data off of the receive queue.
*/ */
/* [module] import Util from "./util.js";
* import Util from "./util";
*/
/*jslint browser: true, bitwise: true */ /*jslint browser: true, bitwise: true */
/*global Util*/ /*global Util*/
/* [module] export default */ function Websock() { export default function Websock() {
"use strict"; "use strict";
this._websocket = null; // WebSocket object this._websocket = null; // WebSocket object