22
22
require ( 'es6-promise' ) . polyfill ( ) ;
23
23
24
24
// lib functions
25
- var Lib = exports . Lib = require ( './lib' ) ;
25
+ exports . Lib = require ( './lib' ) ;
26
26
exports . util = require ( './lib/svg_text_utils' ) ;
27
27
exports . Queue = require ( './lib/queue' ) ;
28
28
@@ -34,8 +34,7 @@ exports.MathJaxConfig = require('./fonts/mathjax_config');
34
34
exports . defaultConfig = require ( './plot_api/plot_config' ) ;
35
35
36
36
// plots
37
- var Plots = exports . Plots = require ( './plots/plots' ) ;
38
-
37
+ exports . Plots = require ( './plots/plots' ) ;
39
38
exports . Axes = require ( './plots/cartesian/axes' ) ;
40
39
exports . Fx = require ( './plots/cartesian/graph_interact' ) ;
41
40
@@ -52,61 +51,6 @@ exports.Images = require('./components/images');
52
51
exports . UpdateMenus = require ( './components/updatemenus' ) ;
53
52
exports . ModeBar = require ( './components/modebar' ) ;
54
53
55
- exports . register = function register ( _modules ) {
56
- if ( ! _modules ) {
57
- throw new Error ( 'No argument passed to Plotly.register.' ) ;
58
- }
59
- else if ( _modules && ! Array . isArray ( _modules ) ) {
60
- _modules = [ _modules ] ;
61
- }
62
-
63
- for ( var i = 0 ; i < _modules . length ; i ++ ) {
64
- var newModule = _modules [ i ] ;
65
-
66
- if ( ! newModule ) {
67
- throw new Error ( 'Invalid module was attempted to be registered!' ) ;
68
- }
69
-
70
- switch ( newModule . moduleType ) {
71
- case 'trace' :
72
- Plots . register ( newModule , newModule . name , newModule . categories , newModule . meta ) ;
73
-
74
- if ( ! Plots . subplotsRegistry [ newModule . basePlotModule . name ] ) {
75
- Plots . registerSubplot ( newModule . basePlotModule ) ;
76
- }
77
-
78
- break ;
79
-
80
- case 'transform' :
81
- if ( typeof newModule . name !== 'string' ) {
82
- throw new Error ( 'Transform module *name* must be a string.' ) ;
83
- }
84
-
85
- var prefix = 'Transform module ' + newModule . name ;
86
-
87
- if ( typeof newModule . transform !== 'function' ) {
88
- throw new Error ( prefix + ' is missing a *transform* function.' ) ;
89
- }
90
- if ( ! Lib . isPlainObject ( newModule . attributes ) ) {
91
- Lib . log ( prefix + ' registered without an *attributes* object.' ) ;
92
- }
93
- if ( typeof newModule . supplyDefaults !== 'function' ) {
94
- Lib . log ( prefix + ' registered without a *supplyDefaults* function.' ) ;
95
- }
96
-
97
- Plots . transformsRegistry [ newModule . name ] = newModule ;
98
-
99
- break ;
100
-
101
- default :
102
- throw new Error ( 'Invalid module was attempted to be registered!' ) ;
103
- }
104
- }
105
- } ;
106
-
107
- // Scatter is the only trace included by default
108
- exports . register ( require ( './traces/scatter' ) ) ;
109
-
110
54
// plot api
111
55
require ( './plot_api/plot_api' ) ;
112
56
exports . PlotSchema = require ( './plot_api/plot_schema' ) ;
0 commit comments