Alter all js to use new es6 module syntax

This commit is contained in:
Starbeamrainbowlabs 2016-12-26 17:31:32 +00:00
parent dac909fd12
commit 9f835820dc
4 changed files with 15 additions and 1 deletions

View File

@ -1,3 +1,5 @@
"use strict";
/** /**
* Bounded random number generator. Has 3 forms: * Bounded random number generator. Has 3 forms:
* *
@ -18,3 +20,4 @@
function random(a,b,c,d) function random(a,b,c,d)
{d=Math.random();if(typeof a!="number")return d;a=typeof b=="number"?d*(a-b)+b:d*a;a=(typeof b!="number"?b:c)?a:Math.floor(a);return a;} {d=Math.random();if(typeof a!="number")return d;a=typeof b=="number"?d*(a-b)+b:d*a;a=(typeof b!="number"?b:c)?a:Math.floor(a);return a;}
export default random;

View File

@ -1,5 +1,7 @@
"use strict"; "use strict";
import Vector from './Vector';
class Star class Star
{ {
constructor(inCanvas, inPosition, inSize) constructor(inCanvas, inPosition, inSize)
@ -28,3 +30,5 @@ class Star
context.restore(); context.restore();
} }
} }
export default Star;

View File

@ -1,5 +1,12 @@
"use strict"; "use strict";
import random from './Random'; // Bounded random number generation
import Vector from './Vector'; // 2D vector class
// Subclasses
import Star from './Star';
// ~~~
class StarlightRenderer class StarlightRenderer
{ {
constructor(canvas) constructor(canvas)

View File

@ -215,4 +215,4 @@ class Vector {
} }
} }
// Make Vector.js Node.js friendly // Make Vector.js Node.js friendly
if (typeof module != "undefined" && module.exports) module.exports = Vector; export default Vector;