Combine default parameters and destructuring for a compact version of the defaults / overrides pattern.
function foo ({
bar = 'no',
baz = 'works!'
} = {}) {| // http://paulirish.com/2011/requestanimationframe-for-smart-animating/ | |
| // http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating | |
| // requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel | |
| // MIT license | |
| (function() { | |
| var lastTime = 0; | |
| var vendors = ['ms', 'moz', 'webkit', 'o']; |
| #!/bin/zsh | |
| find . -name '*.js.map' -exec sh -c 'rm ${0%.map}.js $0' {} \; |
| /** | |
| * Decorator for controller classes for route states. You can reference the class in the | |
| * `controller` property. Name is a required property on the config if using the | |
| * registerState helper. | |
| * @return Function which takes a UI Router config object. | |
| */ | |
| export default RouteConfig(target) { | |
| return function(config) { | |
| target.$uiRouteConfig = config; | |
| } |
Purpose of my lightning talk is to present insights I've reached as a reviewer/ reviewee in the last couple of months.
I will answer these questions:
| import hify from './create-element'; | |
| import React from 'react'; | |
| import { render } from 'react-dom'; | |
| const h = hify(React.createElement.bind(React)); | |
| class Test extends HTMLElement { | |
| static observedAttributes = ['attr'] | |
| attributeChangedCallback (name, oldValue, newValue) { | |
| this.innerHTML = `Hello, ${this.getAttribute('attr')}!`; |
DOM Element recycling will be removed in Preact 8.
This should have no effect on most applications. In fact, it fixes a number of known issues related to element state not being fully reset on reuse.
💡 Why? Many DOM properties are stateful, and trying to reset them all when recycling is a game of whack-a-mole. Preact's size makes it infeasible to use whitelists to address these issues, so recycling is being dropped. >
| /** | |
| * Copyright 2017 Google Inc. | |
| * | |
| * Licensed under the Apache License, Version 2.0 (the "License"); | |
| * you may not use this file except in compliance with the License. | |
| * You may obtain a copy of the License at | |
| * | |
| * https://www.apache.org/licenses/LICENSE-2.0 | |
| * | |
| * Unless required by applicable law or agreed to in writing, software |