em
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function formDataFrom(obj: { [key: string]: string | number }) { | |
let formData = new FormData() | |
for (let key in obj) { | |
formData.append(key, String(obj[key])) | |
} | |
return formData | |
} | |
export default formDataFrom |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let scrollEnhanced = (Inner) => { | |
return class ScrollEnhanced extends Component { | |
render () { | |
return <Inner {...this.props} {...scrollEnhancedStuff} /> | |
} | |
} | |
} | |
// ... later |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class A extends Component { | |
doSomething = async () => { | |
this.setState({pending: true}) | |
try { | |
await doSomething() | |
} catch (err) { | |
} finally { | |
this.setState({pending: true}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
return (state: State = defaultState, action: Action) => { | |
let { _persist, ...rest } = state || {} | |
let restState: State = rest | |
switch (action.type) { | |
case PERSIST: | |
if (state._persist) { | |
console.warn( | |
'redux-persist: unexpected _persist state before PERSIST action is handled. If you are doing hmr or code-splitting this may be a valid use case. Please open a ticket, requires further review.' | |
) |
Drive Markdown is a strict subset of markdown supporting the following syntax:
name | syntax | example |
---|---|---|
bold | **bold** |
bold |
heading1 | # heading |
# heading |
heading(N<5) | ### heading (N=3) |
### heading |
link | [link](https://google.com) |
link |
ordered list | ab | ab |
unordered list | ab | ab |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// time iterator (read: debounce) | |
if (timeIterator === null) { | |
timeIterator = setInterval(processNextReducer, debounce) | |
} | |
function flush () { | |
storesToProcess.forEeach(processNextReducer) | |
} | |
function processNextReducer () { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { createTransform, getStoredState, purgeStoredState } from 'redux-persist' | |
import { autoRehydrate as baseAutoRehydrate, createPersistor as baseCreatePersistor, persistStore as basePersistStore } | |
export { createTransform, getStoredState, purgeStoredState } | |
import immutableConfig from './immutableConfig' // basically verbatim redux-persist-immutable-state but keys renamed: _stateInit, _stateGetter, ... | |
import stateReconciler from './stateReconciler' | |
// perhaps we should add some validation to make sure stateReconciler is not being overriden? | |
export const autoRehydrate = (config, ...args) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {getStoredState, createPersistor, autoRehydrate } from 'redux-persist' | |
export async function bootstrap () { | |
let initialState | |
try { | |
initialState = await getStoredState() | |
} catch (err) { | |
initialState = {} | |
} |
NewerOlder