Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit c9b155b

Browse files
prettier on factory
1 parent d068682 commit c9b155b

File tree

2 files changed

+53
-48
lines changed

2 files changed

+53
-48
lines changed

β€Ž.prettierrcβ€Ž

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"singleQuote": true,
3+
"bracketSpacing": false,
4+
"trailingComma": "es5"
5+
}

β€Žsrc/factory.jsβ€Ž

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,51 @@
1-
import React, {Component} from "react";
2-
import PropTypes from "prop-types";
3-
import isNumeric from "fast-isnumeric";
4-
import objectAssign from "object-assign";
1+
import React, {Component} from 'react';
2+
import PropTypes from 'prop-types';
3+
import isNumeric from 'fast-isnumeric';
4+
import objectAssign from 'object-assign';
55
// import throttle from "throttle-debounce/throttle";
66

77
// The naming convention is:
88
// - events are attached as `'plotly_' + eventName.toLowerCase()`
99
// - react props are `'on' + eventName`
1010
const eventNames = [
11-
"AfterExport",
12-
"AfterPlot",
13-
"Animated",
14-
"AnimatingFrame",
15-
"AnimationInterrupted",
16-
"AutoSize",
17-
"BeforeExport",
18-
"ButtonClicked",
19-
"Click",
20-
"ClickAnnotation",
21-
"Deselect",
22-
"DoubleClick",
23-
"Framework",
24-
"Hover",
25-
"Relayout",
26-
"Restyle",
27-
"Redraw",
28-
"Selected",
29-
"Selecting",
30-
"SliderChange",
31-
"SliderEnd",
32-
"SliderStart",
33-
"Transitioning",
34-
"TransitionInterrupted",
35-
"Unhover",
11+
'AfterExport',
12+
'AfterPlot',
13+
'Animated',
14+
'AnimatingFrame',
15+
'AnimationInterrupted',
16+
'AutoSize',
17+
'BeforeExport',
18+
'ButtonClicked',
19+
'Click',
20+
'ClickAnnotation',
21+
'Deselect',
22+
'DoubleClick',
23+
'Framework',
24+
'Hover',
25+
'Relayout',
26+
'Restyle',
27+
'Redraw',
28+
'Selected',
29+
'Selecting',
30+
'SliderChange',
31+
'SliderEnd',
32+
'SliderStart',
33+
'Transitioning',
34+
'TransitionInterrupted',
35+
'Unhover',
3636
];
3737

3838
const updateEvents = [
39-
"plotly_restyle",
40-
"plotly_redraw",
41-
"plotly_relayout",
42-
"plotly_doubleclick",
43-
"plotly_animated",
39+
'plotly_restyle',
40+
'plotly_redraw',
41+
'plotly_relayout',
42+
'plotly_doubleclick',
43+
'plotly_animated',
4444
];
4545

4646
// Check if a window is available since SSR (server-side rendering)
4747
// breaks unnecessarily if you try to use it server-side.
48-
const isBrowser = typeof window !== "undefined";
48+
const isBrowser = typeof window !== 'undefined';
4949

5050
export default function plotComponentFactory(Plotly) {
5151
const hasReactAPIMethod = !!Plotly.react;
@@ -93,7 +93,7 @@ export default function plotComponentFactory(Plotly) {
9393
() => this.props.onInitialized && this.props.onInitialized(this.el)
9494
)
9595
.catch(e => {
96-
console.error("Error while plotting:", e);
96+
console.error('Error while plotting:', e);
9797
return this.props.onError && this.props.onError();
9898
});
9999
}
@@ -125,14 +125,14 @@ export default function plotComponentFactory(Plotly) {
125125
.then(this.attachUpdateEvents)
126126
.then(() => this.handleUpdate(nextProps))
127127
.catch(err => {
128-
console.error("Error while plotting:", err);
128+
console.error('Error while plotting:', err);
129129
this.props.onError && this.props.onError(err);
130130
});
131131
}
132132

133133
componentWillUnmount() {
134134
if (this.resizeHandler && isBrowser) {
135-
window.removeEventListener("resize", this.handleResize);
135+
window.removeEventListener('resize', this.handleResize);
136136
this.resizeHandler = null;
137137
}
138138

@@ -163,7 +163,7 @@ export default function plotComponentFactory(Plotly) {
163163

164164
handleUpdate(props) {
165165
props = props || this.props;
166-
if (props.onUpdate && typeof props.onUpdate === "function") {
166+
if (props.onUpdate && typeof props.onUpdate === 'function') {
167167
props.onUpdate(this.el);
168168
}
169169
}
@@ -176,11 +176,11 @@ export default function plotComponentFactory(Plotly) {
176176
this.resizeHandler = () => {
177177
return Plotly.relayout(this.el, this.getSize());
178178
};
179-
window.addEventListener("resize", this.resizeHandler);
179+
window.addEventListener('resize', this.resizeHandler);
180180

181181
if (invoke) return this.resizeHandler();
182182
} else if (!props.fit && this.resizeHandler) {
183-
window.removeEventListener("resize", this.resizeHandler);
183+
window.removeEventListener('resize', this.resizeHandler);
184184
this.resizeHandler = null;
185185
}
186186
}
@@ -200,16 +200,16 @@ export default function plotComponentFactory(Plotly) {
200200

201201
for (let i = 0; i < eventNames.length; i++) {
202202
const eventName = eventNames[i];
203-
const prop = props["on" + eventName];
203+
const prop = props['on' + eventName];
204204
const hasHandler = !!this.handlers[eventName];
205205

206206
if (prop && !hasHandler) {
207-
let handler = (this.handlers[eventName] = props["on" + eventName]);
208-
this.el.on("plotly_" + eventName.toLowerCase(), handler);
207+
let handler = (this.handlers[eventName] = props['on' + eventName]);
208+
this.el.on('plotly_' + eventName.toLowerCase(), handler);
209209
} else if (!prop && hasHandler) {
210210
// Needs to be removed:
211211
this.el.off(
212-
"plotly_" + eventName.toLowerCase(),
212+
'plotly_' + eventName.toLowerCase(),
213213
this.handlers[eventName]
214214
);
215215
delete this.handlers[eventName];
@@ -252,8 +252,8 @@ export default function plotComponentFactory(Plotly) {
252252
return (
253253
<div
254254
style={{
255-
position: "relative",
256-
display: "inline-block",
255+
position: 'relative',
256+
display: 'inline-block',
257257
}}
258258
ref={this.getRef}
259259
/>
@@ -275,7 +275,7 @@ export default function plotComponentFactory(Plotly) {
275275
};
276276

277277
for (let i = 0; i < eventNames.length; i++) {
278-
PlotlyComponent.propTypes["on" + eventNames[i]] = PropTypes.func;
278+
PlotlyComponent.propTypes['on' + eventNames[i]] = PropTypes.func;
279279
}
280280

281281
PlotlyComponent.defaultProps = {

0 commit comments

Comments
(0)

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /