Skip to content

Instantly share code, notes, and snippets.

@daKmoR
Created February 18, 2020 12:24
Show Gist options
  • Save daKmoR/88bd44f090c6a107893bb9c57845ecb0 to your computer and use it in GitHub Desktop.
Save daKmoR/88bd44f090c6a107893bb9c57845ecb0 to your computer and use it in GitHub Desktop.
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 }
};
}
updated(changedProperties) {
super.updated(changedProperties);
if (changedProperties.has('locale')) {
// react to locale change
}
}
},
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment