Croquet in Modules

We consider how Croquet might mix with ES6 modules.

It must have some access to the DOM that I don't pass in. For example, the swirly connecting animation. discord

We append an export declaration after the minified croquet.js from the CDN. unpkg

We import croquet and the Model and View classes.

pages/super-collaborator/croquet-in-modules

This works. What I don't understand is how this code in the count.js module can reach the div in the html?

counterChanged() { countDisplay.textContent = this.model.count; }

This is more about my misunderstanding of module scope than anything about Croquet.

> HTML+JS is far from โ€œpure.โ€œ Any HTML element that has an id attribute is available globally to all JS in the page context. Even in a module all globals are still accessible.

Wow. I have exploited this myself but thought I lost it when I use <script type="module">

> Nope, still there ๐Ÿ˜…

Hurray for the Croquet team for their (your) deep knowledge of html/js, and your willingness to share.

.

SES?