ES6 Mixins

Jan Miksovsky is an designer/developer expert at on Web Components. Only interested in coding approaches that can be shared with other people. With emphasis on styling and reuse - twitter

Many web developers come to reuse through design. We look at his work for clarity on how to decompose to implement ES6 'strict mode' - rewrote its backend server to rip out a popular templating language and replaced it with plain JavaScript functions. After language improvements in ES2015 -

On implementing web component mixins as functions

- "ES6 template strings let us easily embed HTML directly inside of JavaScript files, instead of putting JavaScript code inside of HTML files as we did with HTML Imports."

- "Both packaging formats can work, but given the need for JavaScript modules anyway, it seems worthwhile for us to see what we can build with modules alone.

- Stencil.js was introduced recently at the 2017 Polymer Summit -

- Service Workers have indeterminate lifetimes and I think the only way to wake them up is for them to receive a push notification. -

Since the term "framework" can provoke strong negative reactions, authors of such code may actually care whether their code is labeled a framework or not -

- Google, for example, seems to take great pains to avoid describing its own Polymer project as a framework. They call it a "library", which sounds perhaps smaller or less threatening.

- Polymer easily meets all of the above framework criteria. For example, Polymer's internal asynchronous task-scheduling infrastructure establishes the flow of control in a Polymer application, determining when to invoke component lifecycle callbacks and property observers.

- Polymer (library) has begun to gain increasing recognition in the market, with special attention paid to its structured design process, allowing for an interoperable "lego block" structure.


After a little more inspection, there's still an awful lot of code. Wonder if the reactive part is worth the effort. Might be that what I really want is much simpler. The Power of Web Components. article

Shim for custom elements in browsers that aren't quite there yet Found this article helpful... leaving it here for now.

Hybrid.js also eschews class-based inheritance when creating ES6 components. On closer look at the source, this is still not what I'm looking for.

The source code for polymer's `lit-element` looks interesting. github

Also interested in the example of `lit-element` hosted at glitch: glitch