If you haven't already set your NPM author info, now you should:
npm set init.author.name "Your Name"
npm set init.author.email "[email protected]"
npm set init.author.url "http://yourblog.com"
npm adduser
var React = require('react'); | |
var events = require('add-event-listener'); | |
var isVisible = require('../isVisible'); | |
var LazyLoad = React.createClass({ | |
displayName: 'LazyLoad', | |
propTypes: { | |
distance: React.PropTypes.number, | |
component: React.PropTypes.node.isRequired, | |
children: React.PropTypes.node.isRequired |
{ | |
"comment": "This is the settings file for the SVGO Compressor Plugin. For more info, please check <https://github.com/BohemianCoding/svgo-compressor>", | |
"pretty": false, | |
"indent": 2, | |
"plugins": [ | |
{ | |
"name": "cleanupAttrs" | |
}, | |
{ | |
"name": "cleanupEnableBackground" |
If you haven't already set your NPM author info, now you should:
npm set init.author.name "Your Name"
npm set init.author.email "[email protected]"
npm set init.author.url "http://yourblog.com"
npm adduser
function retry(isDone, next) { | |
var current_trial = 0, max_retry = 50, interval = 10, is_timeout = false; | |
var id = window.setInterval( | |
function() { | |
if (isDone()) { | |
window.clearInterval(id); | |
next(is_timeout); | |
} | |
if (current_trial++ > max_retry) { | |
window.clearInterval(id); |
var | |
// Local ip address that we're trying to calculate | |
address | |
// Provides a few basic operating-system related utility functions (built-in) | |
,os = require('os') | |
// Network interfaces | |
,ifaces = os.networkInterfaces(); | |
// Iterate over interfaces ... |
All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.
elem.offsetLeft
, elem.offsetTop
, elem.offsetWidth
, elem.offsetHeight
, elem.offsetParent
elem.clientLeft
, elem.clientTop
, elem.clientWidth
, elem.clientHeight
elem.getClientRects()
, elem.getBoundingClientRect()
Time Travel refers to the ability to record a tab and later replay it ([WebReplay][wrr]). The technology is useful for local development, where you might want to:
function logger(strings,...values) { | |
var str = ""; | |
for (let i = 0; i < strings.length; i++) { | |
if (i > 0) { | |
if (values[i-1] && typeof values[i-1] == "object") { | |
if (values[i-1] instanceof Error) { | |
if (values[i-1].stack) { | |
str += values[i-1].stack; | |
continue; | |
} |