Skip to content

Instantly share code, notes, and snippets.

@Westbrook
Westbrook / SassMeister-input.scss
Created Apr 22, 2014
Generated by SassMeister.com.
View SassMeister-input.scss
// ----
// libsass (v0.7.0)
// ----
%extend {
@media only screen and (max-width: 600px) {
width:100%;
}
}
@Westbrook
Westbrook / SassMeister-input.scss
Created Apr 23, 2014
Generated by SassMeister.com.
View SassMeister-input.scss
// ----
// libsass (v0.7.0)
// ----
%extended {
border: none;
}
%extend {
width: 100%;
@Westbrook
Westbrook / lit-use-effect-element.js
Last active Oct 28, 2018
useEffect() for `LitElement`... because everyone's doing it?
View lit-use-effect-element.js
import {LitElement, html} from '@polymer/lit-element';
import {UseEffectMixin} from './use-effect.js';
class MyElement extends UseEffectMixin(LitElement) {
static get properties() {
return {
mood: {type: String},
expression: {type: String}
}
}
View events.js
import htm from 'https://unpkg.com/htm?module'; // for parity of renderer plus access to element properties
const handler = (e) => console.log("You've got an event at the parent level:",e);
const eventToComponent = htm`<MyComponent onSomething=${handler} />`;
const eventToCustomElement = htm`<my-component onSomething=${handler} />`;
// OR, you can use capturing to manage this sort of thing via central data store
document.body.addEventListener('something', e => {