I’ve been playing around with web components for a week or so and am trying to wrap everything up into something reusable.
I’m struggling to create an inheritance hierarchy using modules. The idea is/was to have
App extends HTMLElement
Screen extends App
Page extends Screen
NestedElements extend Screen
Each module loads sub modules but it does not work how I was expecting.
Every file has to include the class I’m extending i.e
/* Intro page component */
import Screen from '../screen.js';
export default class Intro extends Screen
And every extend is creating a new instance of Screen, seems like a waste but I don’t know where the imports are scoped.
Just want to ask if I am going about this in the correct way, and possibly get some pointer on what to improve.
Here is an example of what I have so far.
http://pwaprojects.co.uk/lofi/
Thanks