From d9ce6387a382b0a1c3d499e840c79a50fca3d0ff Mon Sep 17 00:00:00 2001 From: Starbeamrainbowlabs Date: Thu, 9 Nov 2017 21:35:56 +0000 Subject: [PATCH] [client] Rewrite to use es6 import everywhere for npm modules --- Nibriboard/ClientFiles/BoardWindow.js | 8 ++++---- Nibriboard/ClientFiles/ClientManager.js | 2 +- Nibriboard/ClientFiles/Interface.js | 2 +- Nibriboard/ClientFiles/Pencil.js | 7 +++---- Nibriboard/ClientFiles/RippleLink.js | 2 +- Nibriboard/ClientFiles/index.js | 2 +- 6 files changed, 11 insertions(+), 12 deletions(-) diff --git a/Nibriboard/ClientFiles/BoardWindow.js b/Nibriboard/ClientFiles/BoardWindow.js index 9cfddbf..dbb47ca 100644 --- a/Nibriboard/ClientFiles/BoardWindow.js +++ b/Nibriboard/ClientFiles/BoardWindow.js @@ -1,9 +1,9 @@ "use strict"; // npm modules -window.EventEmitter = require("event-emitter-es6"); -window.FaviconNotification = require("favicon-notification"); -window.panzoom = require("pan-zoom"); +import EventEmitter from "event-emitter-es6"; +import FaviconNotification from "favicon-notification"; +import panzoom from "pan-zoom"; // Our files import RippleLink from './RippleLink'; @@ -140,7 +140,7 @@ class BoardWindow extends EventEmitter FaviconNotification.add(); // Setup the input controls - window.panzoom(canvas, this.handleCanvasMovement.bind(this)); + panzoom(canvas, this.handleCanvasMovement.bind(this)); // --~~~-- diff --git a/Nibriboard/ClientFiles/ClientManager.js b/Nibriboard/ClientFiles/ClientManager.js index f844dfc..7dcf805 100644 --- a/Nibriboard/ClientFiles/ClientManager.js +++ b/Nibriboard/ClientFiles/ClientManager.js @@ -1,6 +1,6 @@ "use strict"; -window.EventEmitter = require("event-emitter-es6"); +import EventEmitter from "event-emitter-es6"; import OtherClient from './OtherClient'; import Vector from './Utilities/Vector'; diff --git a/Nibriboard/ClientFiles/Interface.js b/Nibriboard/ClientFiles/Interface.js index f216f55..2cc1bbe 100644 --- a/Nibriboard/ClientFiles/Interface.js +++ b/Nibriboard/ClientFiles/Interface.js @@ -1,6 +1,6 @@ "use strict"; -window.EventEmitter = require("event-emitter-es6"); +import EventEmitter from "event-emitter-es6"; import BrushIndicator from './BrushIndicator.js'; diff --git a/Nibriboard/ClientFiles/Pencil.js b/Nibriboard/ClientFiles/Pencil.js index a23bfec..eeeb0ea 100644 --- a/Nibriboard/ClientFiles/Pencil.js +++ b/Nibriboard/ClientFiles/Pencil.js @@ -1,12 +1,11 @@ "use strict"; +import cuid from "cuid"; +import { simplify_line } from "visvalingam-simplifier"; + import Vector from './Utilities/Vector'; - import Mouse from './Utilities/Mouse'; -var cuid = require("cuid"); -var simplify_line = require("visvalingam-simplifier").simplify_line; - class Pencil { /** diff --git a/Nibriboard/ClientFiles/RippleLink.js b/Nibriboard/ClientFiles/RippleLink.js index a06c845..ee725e2 100644 --- a/Nibriboard/ClientFiles/RippleLink.js +++ b/Nibriboard/ClientFiles/RippleLink.js @@ -2,7 +2,7 @@ import { WebSocketStates, ReverseWebSocketStates } from './Utilities/WebSocketStates'; -const EventEmitter = require("event-emitter-es6"); +import EventEmitter from "event-emitter-es6"; class RippleLink extends EventEmitter { diff --git a/Nibriboard/ClientFiles/index.js b/Nibriboard/ClientFiles/index.js index dcf17df..6d69857 100644 --- a/Nibriboard/ClientFiles/index.js +++ b/Nibriboard/ClientFiles/index.js @@ -1,6 +1,6 @@ "use strict"; -window.FpsIndicator = require("fps-indicator"); +import FpsIndicator from "fps-indicator"; import BoardWindow from './BoardWindow';