Skip to content

codewithkyle/es-modules-static-classes-prototype

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ES Modules Static Class Importing

This prototype is designed to test using the ES Modules import keyword for 'static' classes. This prototype shows that we can import a single instance of a state manager class into several web components.

How It Works

This demo is composed of a state manager class and two Web Components. The StateManager class contains a state object that tracks a timestamp and web component name. It has a public ping() method that allows web components to update the timestamp. Both the web-component and second-component elements are web components. Their JavaScript files user type="module" allowing them to import the StateManger class using import { StateManager } from './state-manager.js. When the web components connectedCallback() method is called they begin calling the StateManger.ping() method on set intervals.

About

Prototyping the ES Module import syntax for 'static' classes

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published