Skip to content

Commit 8a141ea

Browse files
committed
lint: no need to check for Plotly.Queue existence
- use Lib not Plotly.Lib in queue.js - some space pads - fix typo in plot_config.js comment
1 parent e1786dc commit 8a141ea

File tree

4 files changed

+15
-24
lines changed

4 files changed

+15
-24
lines changed

src/lib/queue.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
'use strict';
1111

12-
var Plotly = require('../plotly');
12+
var Lib = require('../lib');
1313

1414
/**
1515
* Copy arg array *without* removing `undefined` values from objects.
@@ -28,8 +28,8 @@ function copyArgArray(gd, args) {
2828
if(arg === gd) copy[i] = arg;
2929
else if(typeof arg === 'object') {
3030
copy[i] = Array.isArray(arg) ?
31-
Plotly.Lib.extendDeep([], arg) :
32-
Plotly.Lib.extendDeepAll({}, arg);
31+
Lib.extendDeep([], arg) :
32+
Lib.extendDeepAll({}, arg);
3333
}
3434
else copy[i] = arg;
3535
}

src/plot_api/plot_api.js

+10-20
Original file line numberDiff line numberDiff line change
@@ -1263,9 +1263,7 @@ Plotly.extendTraces = function extendTraces(gd, update, indices, maxPoints) {
12631263
var promise = Plotly.redraw(gd);
12641264

12651265
var undoArgs = [gd, undo.update, indices, undo.maxPoints];
1266-
if(Queue) {
1267-
Queue.add(gd, Plotly.prependTraces, undoArgs, extendTraces, arguments);
1268-
}
1266+
Queue.add(gd, Plotly.prependTraces, undoArgs, extendTraces, arguments);
12691267

12701268
return promise;
12711269
};
@@ -1292,9 +1290,7 @@ Plotly.prependTraces = function prependTraces(gd, update, indices, maxPoints) {
12921290
var promise = Plotly.redraw(gd);
12931291

12941292
var undoArgs = [gd, undo.update, indices, undo.maxPoints];
1295-
if(Queue) {
1296-
Queue.add(gd, Plotly.extendTraces, undoArgs, prependTraces, arguments);
1297-
}
1293+
Queue.add(gd, Plotly.extendTraces, undoArgs, prependTraces, arguments);
12981294

12991295
return promise;
13001296
};
@@ -1342,7 +1338,7 @@ Plotly.addTraces = function addTraces(gd, traces, newIndices) {
13421338
// i.e., we can simply redraw and be done
13431339
if(typeof newIndices === 'undefined') {
13441340
promise = Plotly.redraw(gd);
1345-
if(Queue) Queue.add(gd, undoFunc, undoArgs, redoFunc, redoArgs);
1341+
Queue.add(gd, undoFunc, undoArgs, redoFunc, redoArgs);
13461342
return promise;
13471343
}
13481344

@@ -1365,10 +1361,10 @@ Plotly.addTraces = function addTraces(gd, traces, newIndices) {
13651361

13661362
// if we're here, the user has defined specific places to place the new traces
13671363
// this requires some extra work that moveTraces will do
1368-
if(Queue) Queue.startSequence(gd);
1369-
if(Queue) Queue.add(gd, undoFunc, undoArgs, redoFunc, redoArgs);
1364+
Queue.startSequence(gd);
1365+
Queue.add(gd, undoFunc, undoArgs, redoFunc, redoArgs);
13701366
promise = Plotly.moveTraces(gd, currentIndices, newIndices);
1371-
if(Queue) Queue.stopSequence(gd);
1367+
Queue.stopSequence(gd);
13721368
return promise;
13731369
};
13741370

@@ -1409,8 +1405,7 @@ Plotly.deleteTraces = function deleteTraces(gd, indices) {
14091405
}
14101406

14111407
var promise = Plotly.redraw(gd);
1412-
1413-
if(Queue) Queue.add(gd, undoFunc, undoArgs, redoFunc, redoArgs);
1408+
Queue.add(gd, undoFunc, undoArgs, redoFunc, redoArgs);
14141409

14151410
return promise;
14161411
};
@@ -1508,8 +1503,7 @@ Plotly.moveTraces = function moveTraces(gd, currentIndices, newIndices) {
15081503
gd.data = newData;
15091504

15101505
var promise = Plotly.redraw(gd);
1511-
1512-
if(Queue) Queue.add(gd, undoFunc, undoArgs, redoFunc, redoArgs);
1506+
Queue.add(gd, undoFunc, undoArgs, redoFunc, redoArgs);
15131507

15141508
return promise;
15151509
};
@@ -1955,9 +1949,7 @@ Plotly.restyle = function restyle(gd, astr, val, traces) {
19551949

19561950
// now all attribute mods are done, as are redo and undo
19571951
// so we can save them
1958-
if(Queue) {
1959-
Queue.add(gd, restyle, [gd, undoit, traces], restyle, [gd, redoit, traces]);
1960-
}
1952+
Queue.add(gd, restyle, [gd, undoit, traces], restyle, [gd, redoit, traces]);
19611953

19621954
// do we need to force a recalc?
19631955
var autorangeOn = false;
@@ -2375,9 +2367,7 @@ Plotly.relayout = function relayout(gd, astr, val) {
23752367
}
23762368
// now all attribute mods are done, as are
23772369
// redo and undo so we can save them
2378-
if(Queue) {
2379-
Queue.add(gd, relayout, [gd, undoit], relayout, [gd, redoit]);
2380-
}
2370+
Queue.add(gd, relayout, [gd, undoit], relayout, [gd, redoit]);
23812371

23822372
// calculate autosizing - if size hasn't changed,
23832373
// will remove h&w so we don't need to redraw

src/plot_api/plot_config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
var Lib = require('../lib');
1212

1313
/**
14-
* This will be transfered over to gd and overridden by
14+
* This will be transferred over to gd and overridden by
1515
* config args to Plotly.plot.
1616
*
1717
* The defaults are the appropriate settings for plotly.js,

test/jasmine/tests/plot_api_test.js

+1
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,7 @@ describe('Test plot api', function() {
420420

421421
describe('Plotly.ExtendTraces', function() {
422422
var gd;
423+
423424
beforeEach(function() {
424425
gd = {
425426
data: [

0 commit comments

Comments
 (0)