Jump to content

JavaScript: Difference between revisions

Line 271: Line 271:
import * as THREE from 'three';
import * as THREE from 'three';
// Import MyClass as a module. webpack will resolve this.
// Import MyClass as a module. webpack will resolve this.
import MyClass from "./MyClass.js";
import {MyClass} from "./MyClass.js";


// Pretend we're writing another class
// Pretend we're writing another class
export default class MyOtherClass {
export class MyOtherClass {
   constructor() {}
   constructor() {}
}
}
</syntaxhighlight>
</syntaxhighlight>
;Notes
* The Google style guide suggests always using named exports rather than using <code>export default</code>.


==Web Workers==
==Web Workers==