Skip to content

Instantly share code, notes, and snippets.

View daKmoR's full-sized avatar
❤️
Web Components & open-wc

Thomas Allmer daKmoR

❤️
Web Components & open-wc
View GitHub Profile
@daKmoR
daKmoR / Markdium-JavaScript.js
Created April 6, 2020 21:35
Markdium-The evolution of open-wc scoped-elements
import { LitElement } from 'lit-element';
import { ScopedElementsMixin } from '@open-wc/scoped-elements';
import { MyPanel } from './MyPanel.js';
export class MyElement extends ScopedElementsMixin(LitElement) {
static get scopedElements() {
return {
'my-panel': MyPanel,
};
}
@daKmoR
daKmoR / Markdium-JavaScript.js
Created April 6, 2020 21:35
Markdium-The evolution of open-wc scoped-elements
import { LitElement, html, css } from 'lit-element';
import { ScopedElementsMixin } from '@open-wc/scoped-elements';
import { FeatureA } from 'feature-a';
import { FeatureB } from 'feature-b';
export class PageA extends ScopedElementsMixin(LitElement) {
static get scopedElements() {
return {
'feature-a': FeatureA,
'feature-b': FeatureB,
@daKmoR
daKmoR / Markdium-JavaScript.js
Created April 6, 2020 21:35
Markdium-The evolution of open-wc scoped-elements
import { LitElement } from 'lit-element';
import { ScopedElementsMixin } from '@open-wc/scoped-elements';
import { MyPanel } from './MyPanel.js';
export class MyElement extends ScopedElementsMixin(LitElement) {
static get scopedElements() {
return {
'my-panel': MyPanel,
};
}
@daKmoR
daKmoR / Markdium-JavaScript.js
Created February 18, 2020 12:24
Markdium-What is a Mixin?
import { dedupeMixin } from '@open-wc/dedupe-mixin';
export const MyMixin = dedupeMixin(
superclass =>
class MyMixin extends superclass {
// your mixin code goes here
},
);
@daKmoR
daKmoR / Markdium-Shell.bash
Created February 18, 2020 12:24
Markdium-What is a Mixin?
npm i @open-wc/dedupe-mixin
@daKmoR
daKmoR / Markdium-JavaScript.js
Created February 18, 2020 12:24
Markdium-What is a Mixin?
import { isIE11 } from './helpers.js';
if (isIE11()) {}
@daKmoR
daKmoR / Markdium-JavaScript.js
Created February 18, 2020 12:24
Markdium-What is a Mixin?
class Page {}
class PageRed extends Page {}
class PageGreen extends Page {}
class PageBlue extends Page {}
class LoggedPagRed extends PageRed {}
@daKmoR
daKmoR / Markdium-JavaScript.js
Created February 18, 2020 12:24
Markdium-What is a Mixin?
class Page {}
class PageRed extends Page {}
class PageGreen extends Page {}
class PageBlue extends Page {}
@daKmoR
daKmoR / Markdium-JavaScript.js
Created February 18, 2020 12:24
Markdium-What is a Mixin?
import { dedupeMixin } from '@open-wc/dedupe-mixin';
export const LocalizeMixin = dedupeMixin(
superclass =>
class LocalizeMixin extends superclass {
// this assumes a Mixin for LitElement
static get properties() {
return {
locale: { type: String }
};
@daKmoR
daKmoR / Markdium-JavaScript.js
Created February 18, 2020 12:24
Markdium-What is a Mixin?
import { specialAddEventListener } from './helpers.js';
specialAddEventListener(this, 'click', () => console.log('clicked'));