RangeKeyboardFixture.js — react Source File
Architecture documentation for RangeKeyboardFixture.js, a javascript file in the react codebase. 3 imports, 1 dependents.
Entity Profile
Dependency Diagram
graph LR 146d3328_8159_aa68_fad2_e4a3da02b729["RangeKeyboardFixture.js"] bc8ae172_cc20_3692_943c_bbdb1ad34855["Fixture.js"] 146d3328_8159_aa68_fad2_e4a3da02b729 --> bc8ae172_cc20_3692_943c_bbdb1ad34855 2851624d_a736_f3f6_2132_5a20630983fe["Fixture"] 146d3328_8159_aa68_fad2_e4a3da02b729 --> 2851624d_a736_f3f6_2132_5a20630983fe a3aeab4c_4f93_b8d8_01c2_7a351a28a3fb["Fixture"] 146d3328_8159_aa68_fad2_e4a3da02b729 --> a3aeab4c_4f93_b8d8_01c2_7a351a28a3fb ba53c75f_b711_f8f4_9a77_b020529fa33b["index.js"] ba53c75f_b711_f8f4_9a77_b020529fa33b --> 146d3328_8159_aa68_fad2_e4a3da02b729 style 146d3328_8159_aa68_fad2_e4a3da02b729 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import Fixture from '../../Fixture';
const React = window.React;
class RangeKeyboardFixture extends React.Component {
constructor(props, context) {
super(props, context);
this.state = {
keydownCount: 0,
changeCount: 0,
};
}
componentDidMount() {
this.input.addEventListener('keydown', this.handleKeydown, false);
}
componentWillUnmount() {
this.input.removeEventListener('keydown', this.handleKeydown, false);
}
handleChange = () => {
this.setState(({changeCount}) => {
return {
changeCount: changeCount + 1,
};
});
};
handleKeydown = e => {
// only interesting in arrow key events
if ([37, 38, 39, 40].indexOf(e.keyCode) < 0) {
return;
}
this.setState(({keydownCount}) => {
return {
keydownCount: keydownCount + 1,
};
});
};
handleReset = () => {
this.setState({
keydownCount: 0,
changeCount: 0,
});
};
render() {
const {keydownCount, changeCount} = this.state;
const color = keydownCount === changeCount ? 'green' : 'red';
return (
<Fixture>
<div>
<input
type="range"
ref={r => (this.input = r)}
onChange={this.handleChange}
/>
<button onClick={() => this.input.focus()}>Focus Knob</button>
</div>{' '}
<p style={{color}}>
<code>onKeyDown</code>
{' calls: '}
<strong>{keydownCount}</strong>
{' vs '}
<code>onChange</code>
{' calls: '}
<strong>{changeCount}</strong>
</p>
<button onClick={this.handleReset}>Reset counts</button>
</Fixture>
);
}
}
export default RangeKeyboardFixture;
Domain
Subdomains
Classes
Dependencies
Source
Frequently Asked Questions
What does RangeKeyboardFixture.js do?
RangeKeyboardFixture.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Optimization subdomain.
What does RangeKeyboardFixture.js depend on?
RangeKeyboardFixture.js imports 3 module(s): Fixture, Fixture, Fixture.js.
What files import RangeKeyboardFixture.js?
RangeKeyboardFixture.js is imported by 1 file(s): index.js.
Where is RangeKeyboardFixture.js in the architecture?
RangeKeyboardFixture.js is located at fixtures/dom/src/components/fixtures/input-change-events/RangeKeyboardFixture.js (domain: BabelCompiler, subdomain: Optimization, directory: fixtures/dom/src/components/fixtures/input-change-events).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free