diff --git a/src/diagrams/example/exampleDb.js b/src/diagrams/example/exampleDb.js index bdfc9ba5f..0c0982853 100644 --- a/src/diagrams/example/exampleDb.js +++ b/src/diagrams/example/exampleDb.js @@ -23,7 +23,3 @@ exports.setInfo = function (inf) { exports.getInfo = function () { return info } - -exports.parseError = function (err, hash) { - global.mermaidAPI.parseError(err, hash) -} diff --git a/src/diagrams/flowchart/graphDb.js b/src/diagrams/flowchart/graphDb.js index 12dfe12e2..50d8ed683 100644 --- a/src/diagrams/flowchart/graphDb.js +++ b/src/diagrams/flowchart/graphDb.js @@ -400,7 +400,3 @@ exports.indexNodes = function () { exports.getSubGraphs = function () { return subGraphs } - -exports.parseError = function (err, hash) { - global.mermaidAPI.parseError(err, hash) -} diff --git a/src/diagrams/flowchart/parser/flow.spec.js b/src/diagrams/flowchart/parser/flow.spec.js index 475f8a951..7cbe4d9fe 100644 --- a/src/diagrams/flowchart/parser/flow.spec.js +++ b/src/diagrams/flowchart/parser/flow.spec.js @@ -9,9 +9,6 @@ describe('when parsing ', function () { beforeEach(function () { flow.parser.yy = require('../graphDb') flow.parser.yy.clear() - /* flow.parser.parse.parseError= function parseError(str, hash) { - log.debugconsole.log(str); - } */ }) it('should handle a nodes and edges', function () { diff --git a/src/diagrams/gantt/ganttDb.js b/src/diagrams/gantt/ganttDb.js index ff26d3587..be421b243 100644 --- a/src/diagrams/gantt/ganttDb.js +++ b/src/diagrams/gantt/ganttDb.js @@ -352,7 +352,3 @@ var compileTasks = function () { } return allProcessed } - -module.exports.parseError = function (err, hash) { - global.mermaidAPI.parseError(err, hash) -} diff --git a/src/diagrams/sequenceDiagram/sequenceDb.js b/src/diagrams/sequenceDiagram/sequenceDb.js index 45364bd48..9d7ede96e 100644 --- a/src/diagrams/sequenceDiagram/sequenceDb.js +++ b/src/diagrams/sequenceDiagram/sequenceDb.js @@ -97,10 +97,6 @@ module.exports.setTitle = function (titleText) { title = titleText } -module.exports.parseError = function (err, hash) { - global.mermaidAPI.parseError(err, hash) -} - module.exports.apply = function (param) { if (param instanceof Array) { param.forEach(function (item) { diff --git a/src/mermaid.js b/src/mermaid.js index 202eb7c35..5366bc346 100644 --- a/src/mermaid.js +++ b/src/mermaid.js @@ -175,23 +175,18 @@ if (typeof document !== 'undefined') { } const mermaid = { - mermaidAPI, startOnLoad: true, htmlLabels: true, + mermaidAPI, + parse: mermaidAPI.parse, + render: mermaidAPI.render, + init, initialize, version, - parse: mermaidAPI.parse, - parseError: function (err) { - log.debug('Mermaid Syntax error:') - log.debug(err) - }, - render: mermaidAPI.render, - - contentLoaded, - eventEmitter: mermaidAPI.eventEmitter + contentLoaded } export default mermaid diff --git a/src/mermaidAPI.js b/src/mermaidAPI.js index ad3cad359..725cc5969 100644 --- a/src/mermaidAPI.js +++ b/src/mermaidAPI.js @@ -11,8 +11,6 @@ * returns a svg element for the graph. It is is then up to the user of the API to make use of the svg, either insert it * somewhere in the page or something completely different. */ -import EventEmitter from 'events' - var Logger = require('./logger') var log = Logger.Log @@ -38,8 +36,6 @@ var gitGraphRenderer = require('./diagrams/gitGraph/gitGraphRenderer') var gitGraphAst = require('./diagrams/gitGraph/gitGraphAst') var d3 = require('./d3') -module.exports.eventEmitter = new EventEmitter() - /** * ## Configuration * These are the default options which can be overridden with the initialization call as in the example below: @@ -533,21 +529,10 @@ module.exports.getConfig = function () { return config } -module.exports.parseError = function (err, hash) { - if (typeof mermaid !== 'undefined') { - global.mermaid.parseError(err, hash) - } else { - log.debug('Mermaid Syntax error:') - log.debug(err) - } -} - global.mermaidAPI = { render: module.exports.render, parse: module.exports.parse, initialize: module.exports.initialize, detectType: utils.detectType, - parseError: module.exports.parseError, - getConfig: module.exports.getConfig, - eventEmitter: module.exports.eventEmitter + getConfig: module.exports.getConfig } diff --git a/todo.md b/todo.md index bfa2ed479..2cdfcd958 100644 --- a/todo.md +++ b/todo.md @@ -18,4 +18,3 @@ - Replace karma-webpack with karma-babel - Webpack generate mermaid.js & mermaid.core.js - Stops working for mermaid-live-editor since 7.0.9 -- Change emit parseError to throw parseError