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

Appearance settings

Commit d3087b1

Browse filesBrowse files
committed
add index file exporting only API Plotly methods:
- browserify that file so that window.Plotly doesn't contain internal methods
1 parent 3349e7b commit d3087b1
Copy full SHA for d3087b1

File tree

4 files changed

+31
-5
lines changed
Filter options

4 files changed

+31
-5
lines changed

‎package.json

Copy file name to clipboardExpand all lines: package.json
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "1.0.0",
44
"description": "The premier javascript graphing library",
55
"license": "MIT",
6-
"main": "./src/plotly.js",
6+
"main": "./src/index.js",
77
"repository": {
88
"type": "git",
99
"url": "https://github.com/plotly/plotly.js.git"

‎src/index.js

Copy file name to clipboard
+29Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Export the plotly.js API methods.
3+
*
4+
* This file is browserify'ed into a standalone 'Plotly' object.
5+
*
6+
*/
7+
8+
var Plotly = require('./plotly');
9+
10+
// plot api
11+
exports.plot = Plotly.plot;
12+
exports.newPlot = Plotly.newPlot;
13+
exports.restyle = Plotly.restyle;
14+
exports.relayout = Plotly.relayout;
15+
exports.redraw = Plotly.redraw;
16+
exports.extendTraces = Plotly.extendTraces;
17+
exports.prependTraces = Plotly.prependTraces;
18+
exports.addTraces = Plotly.addTraces;
19+
exports.deleteTraces = Plotly.deleteTraces;
20+
exports.moveTraces = Plotly.moveTraces;
21+
22+
// unofficial plot methods, use at your own risk
23+
exports.Plots = Plotly.Plots;
24+
exports.Fx = Plotly.Fx;
25+
26+
// TODO expose snapshot and plot_schema
27+
28+
// export d3 used in the bundle
29+
exports.d3 = require('d3');

‎src/plotly.js

Copy file name to clipboardExpand all lines: src/plotly.js
-3Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,3 @@ exports.Snapshot = require('./snapshot/snapshot');
5858

5959
// queue for undo/redo
6060
exports.Queue = require('./lib/queue');
61-
62-
// export d3 used in the bundle
63-
exports.d3 = require('d3');

‎tasks/util/constants.js

Copy file name to clipboardExpand all lines: tasks/util/constants.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ module.exports = {
1010
pathToSrc: pathToSrc,
1111
pathToMocks: path.join(pathToRoot, 'test/image/mocks'),
1212

13-
pathToPlotlySrc: path.join(pathToSrc, 'plotly.js'),
13+
pathToPlotlySrc: path.join(pathToSrc, 'index.js'),
1414
pathToPlotlyDist: path.join(pathToDist, 'plotly.js'),
1515
pathToPlotlyDistMin: path.join(pathToDist, 'plotly.min.js'),
1616
pathToPlotlyDistWithMeta: path.join(pathToDist, 'plotly-with-meta.js'),

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.