mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2025-07-27 00:19:55 +03:00
Add demo for ES6 map
From alexkuz/redux-devtools-inspector/commit/9dfaaabcfba7913fd15ee6ee43627e0c eb1d5c7b
This commit is contained in:
parent
1bb18a713a
commit
bff3e6d684
|
@ -143,6 +143,9 @@ class DemoApp extends React.Component {
|
||||||
<Button onClick={this.props.addRecursive} style={styles.button}>
|
<Button onClick={this.props.addRecursive} style={styles.button}>
|
||||||
Add Recursive
|
Add Recursive
|
||||||
</Button>
|
</Button>
|
||||||
|
<Button onClick={this.props.addNativeMap} style={styles.button}>
|
||||||
|
Add Native Map
|
||||||
|
</Button>
|
||||||
<Button onClick={this.props.addImmutableMap} style={styles.button}>
|
<Button onClick={this.props.addImmutableMap} style={styles.button}>
|
||||||
Add Immutable Map
|
Add Immutable Map
|
||||||
</Button>
|
</Button>
|
||||||
|
@ -230,6 +233,7 @@ export default connect(
|
||||||
addIterator: () => ({ type: 'ADD_ITERATOR' }),
|
addIterator: () => ({ type: 'ADD_ITERATOR' }),
|
||||||
addHugeObect: () => ({ type: 'ADD_HUGE_OBJECT' }),
|
addHugeObect: () => ({ type: 'ADD_HUGE_OBJECT' }),
|
||||||
addRecursive: () => ({ type: 'ADD_RECURSIVE' }),
|
addRecursive: () => ({ type: 'ADD_RECURSIVE' }),
|
||||||
|
addNativeMap: () => ({ type: 'ADD_NATIVE_MAP' }),
|
||||||
addImmutableMap: () => ({ type: 'ADD_IMMUTABLE_MAP' }),
|
addImmutableMap: () => ({ type: 'ADD_IMMUTABLE_MAP' }),
|
||||||
changeImmutableNested: () => ({ type: 'CHANGE_IMMUTABLE_NESTED' }),
|
changeImmutableNested: () => ({ type: 'CHANGE_IMMUTABLE_NESTED' }),
|
||||||
hugePayload: () => ({
|
hugePayload: () => ({
|
||||||
|
|
|
@ -25,6 +25,25 @@ const IMMUTABLE_MAP = Immutable.Map({
|
||||||
seq: Immutable.Seq.of(1, 2, 3, 4, 5, 6, 7, 8)
|
seq: Immutable.Seq.of(1, 2, 3, 4, 5, 6, 7, 8)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const NATIVE_MAP = new window.Map([
|
||||||
|
['map', new window.Map([
|
||||||
|
[{ first: true }, 1],
|
||||||
|
['second', 2]
|
||||||
|
])],
|
||||||
|
['weakMap', new window.WeakMap([
|
||||||
|
[{ first: true }, 1],
|
||||||
|
[{ second: 1 }, 2]
|
||||||
|
])],
|
||||||
|
['set', new window.Set([
|
||||||
|
{ first: true },
|
||||||
|
'second'
|
||||||
|
])],
|
||||||
|
['weakSet', new window.WeakSet([
|
||||||
|
{ first: true },
|
||||||
|
{ second: 1 }
|
||||||
|
])]
|
||||||
|
]);
|
||||||
|
|
||||||
/* eslint-enable babel/new-cap */
|
/* eslint-enable babel/new-cap */
|
||||||
|
|
||||||
const HUGE_ARRAY = Array.from({ length: 5000 })
|
const HUGE_ARRAY = Array.from({ length: 5000 })
|
||||||
|
@ -71,23 +90,24 @@ export default {
|
||||||
iterators: (state=[], action) => action.type === 'ADD_ITERATOR' ?
|
iterators: (state=[], action) => action.type === 'ADD_ITERATOR' ?
|
||||||
[...state, createIterator()] : state,
|
[...state, createIterator()] : state,
|
||||||
nested: (state=NESTED, action) =>
|
nested: (state=NESTED, action) =>
|
||||||
action.type === 'CHANGE_NESTED' ?
|
action.type === 'CHANGE_NESTED' ? {
|
||||||
{
|
...state,
|
||||||
...state,
|
long: {
|
||||||
long: {
|
nested: [{
|
||||||
nested: [{
|
path: {
|
||||||
path: {
|
to: {
|
||||||
to: {
|
a: state.long.nested[0].path.to.a + '!'
|
||||||
a: state.long.nested[0].path.to.a + '!'
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}]
|
}
|
||||||
}
|
}]
|
||||||
} : state,
|
}
|
||||||
|
} : state,
|
||||||
recursive: (state=[], action) => action.type === 'ADD_RECURSIVE' ?
|
recursive: (state=[], action) => action.type === 'ADD_RECURSIVE' ?
|
||||||
[...state, { ...RECURSIVE }] : state,
|
[...state, { ...RECURSIVE }] : state,
|
||||||
immutables: (state=[], action) => action.type === 'ADD_IMMUTABLE_MAP' ?
|
immutables: (state=[], action) => action.type === 'ADD_IMMUTABLE_MAP' ?
|
||||||
[...state, IMMUTABLE_MAP] : state,
|
[...state, IMMUTABLE_MAP] : state,
|
||||||
|
maps: (state=[], action) => action.type === 'ADD_NATIVE_MAP' ?
|
||||||
|
[...state, NATIVE_MAP] : state,
|
||||||
immutableNested: (state=IMMUTABLE_NESTED, action) => action.type === 'CHANGE_IMMUTABLE_NESTED' ?
|
immutableNested: (state=IMMUTABLE_NESTED, action) => action.type === 'CHANGE_IMMUTABLE_NESTED' ?
|
||||||
state.updateIn(
|
state.updateIn(
|
||||||
['long', 'nested', 0, 'path', 'to', 'a'],
|
['long', 'nested', 0, 'path', 'to', 'a'],
|
||||||
|
@ -96,7 +116,7 @@ export default {
|
||||||
addFunction: (state=null, action) => action.type === 'ADD_FUNCTION' ?
|
addFunction: (state=null, action) => action.type === 'ADD_FUNCTION' ?
|
||||||
{ f: FUNC } : state,
|
{ f: FUNC } : state,
|
||||||
addSymbol: (state=null, action) => action.type === 'ADD_SYMBOL' ?
|
addSymbol: (state=null, action) => action.type === 'ADD_SYMBOL' ?
|
||||||
{ s: window.Symbol('symbol') } : state,
|
{ s: window.Symbol('symbol'), error: new Error('TEST') } : state,
|
||||||
shuffleArray: (state=DEFAULT_SHUFFLE_ARRAY, action) =>
|
shuffleArray: (state=DEFAULT_SHUFFLE_ARRAY, action) =>
|
||||||
action.type === 'SHUFFLE_ARRAY' ?
|
action.type === 'SHUFFLE_ARRAY' ?
|
||||||
shuffle(state) : state
|
shuffle(state) : state
|
||||||
|
|
|
@ -116,11 +116,11 @@ export default class DevtoolsInspector extends Component {
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this.updateSizeMode();
|
this.updateSizeMode();
|
||||||
this.updateSizeTimeout = window.setInterval(this.updateSizeMode.bind(this), 150);
|
this.updateSizeTimeout = setInterval(this.updateSizeMode.bind(this), 150);
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
window.clearTimeout(this.updateSizeTimeout);
|
clearTimeout(this.updateSizeTimeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateMonitorState = monitorState => {
|
updateMonitorState = monitorState => {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user