1 | import * as is from './is';
|
2 | import Core from './core';
|
3 | import extension from './extension';
|
4 | import Stylesheet from './stylesheet';
|
5 | import version from './version';
|
6 | import { warnings } from './util';
|
7 |
|
8 | let cytoscape = function( options ){
|
9 |
|
10 | if( options === undefined ){
|
11 | options = {};
|
12 | }
|
13 |
|
14 |
|
15 | if( is.plainObject( options ) ){
|
16 | return new Core( options );
|
17 | }
|
18 |
|
19 |
|
20 | else if( is.string( options ) ){
|
21 | return extension.apply( extension, arguments );
|
22 | }
|
23 | };
|
24 |
|
25 |
|
26 | cytoscape.use = function( ext ){
|
27 | let args = Array.prototype.slice.call( arguments, 1 );
|
28 |
|
29 | args.unshift( cytoscape );
|
30 |
|
31 | ext.apply( null, args );
|
32 |
|
33 | return this;
|
34 | };
|
35 |
|
36 | cytoscape.warnings = function(bool){
|
37 | return warnings(bool);
|
38 | };
|
39 |
|
40 |
|
41 | cytoscape.version = version;
|
42 |
|
43 |
|
44 | cytoscape.stylesheet = cytoscape.Stylesheet = Stylesheet;
|
45 |
|
46 | export default cytoscape;
|