Skip to content

Commit

Permalink
making top level module .mjs
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisdavidmills committed Oct 1, 2019
1 parent d0e42cf commit d78fc01
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion modules/basic-modules-mjs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
border: 1px solid black;
}
</style>
<script type="module" src="main.js"></script>
<script type="module" src="main.mjs"></script>
</head>
<body>

Expand Down
13 changes: 13 additions & 0 deletions modules/basic-modules-mjs/main.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { create, createReportList } from './modules/canvas.mjs';
import { name, draw, reportArea, reportPerimeter } from './modules/square.mjs';
import randomSquare from './modules/square.mjs';

let myCanvas = create('myCanvas', document.body, 480, 320);
let reportList = createReportList(myCanvas.id);

let square1 = draw(myCanvas.ctx, 50, 50, 100, 'blue');
reportArea(square1.length, reportList);
reportPerimeter(square1.length, reportList);

// Use the default
let square2 = randomSquare(myCanvas.ctx);

0 comments on commit d78fc01

Please sign in to comment.