Virtual Life App with ES6 Modules

Feature Specification

Code Design

·         In the index.html use a script of type module to import the app object and call load()

  <body>
      <script src="http://brickhousecodecamp.org/educationMaterials/workbenchProjects/phase-i/virtual-life-01-app/animate-world.js"></script>
      <script type="module">
 
          import { app } from "./app.js";
 
          app.load();
 
      </script>
  </body>

Notes

·         How to use ES6 Modules for the browser

o    Set scripts in the html to type module

  <script type="module"></script>

o    Use the export key word to export any variables

  export { app }

o    Use the import key word to import any variables

  import { app } from "./app.js";

References