Tested under webpack-dev-server 1.7.0.
- Clone this gist
npm install
npm start
- Visit http://localhost:8080 (or http://192.168.x.x:8080) on multiple devices
- Edit entry.js and hit save
function youtubeDurationToSeconds(duration) { | |
var hours = 0; | |
var minutes = 0; | |
var seconds = 0; | |
// Remove PT from string ref: https://developers.google.com/youtube/v3/docs/videos#contentDetails.duration | |
duration = duration.replace('PT',''); | |
// If the string contains hours parse it and remove it from our duration string | |
if (duration.indexOf('H') > -1) { |
const crypto = require('crypto') | |
const { promisify } = require('util') | |
const pbkdf2 = promisify(crypto.pbkdf2) | |
module.exports = { createHashPasswordFn, isPasswordCorrect } | |
/** | |
* @typedef {Object} HashPassword | |
* @property {String} hash | |
* @property {String} salt |
const Button = forwardRef<CoralButton, ButtonProps>((props, ref) => { | |
const { children, onClick, title, ...coralButtonProps } = props; | |
const buttonRef = useRef<CoralButton>(null); | |
useLayoutEffect(() => { | |
if (ref) { | |
if (isFunction(ref)) { | |
ref(buttonRef.current); | |
} else { |
const readFile = (file) => { | |
let reader = new global.FileReader(); | |
return new Promise((resolve, reject) => { | |
reader.onload = (event) => { | |
file.data = event.target. result; | |
resolve(file); | |
}; | |
reader.onerror = () => { |
Tested under webpack-dev-server 1.7.0.
npm install
npm start
import React, {Component} from 'react' | |
export default DecoratedComponent => | |
class extends Component { | |
state = { | |
hover: false, | |
} | |
toggleHover = () => | |
this.setState({hover: !this.state.hover}) | |
render() { |