feat(Modeler): expose Viewer and NavigatedViewer constructors

This allows bundled users (f.ex without browserify)
to use the modeler + viewers easily without having to monkey patch or
load more than one bundled file.

Closes #541
This commit is contained in:
Ricardo Matias 2016-05-12 13:15:32 +02:00 committed by Nico Rehwaldt
parent 006be69d63
commit 62d9b6f993
2 changed files with 18 additions and 0 deletions

View File

@ -6,6 +6,8 @@ var Ids = require('ids');
var Viewer = require('./Viewer'); var Viewer = require('./Viewer');
var NavigatedViewer = require('./NavigatedViewer');
var initialDiagram = var initialDiagram =
'<?xml version="1.0" encoding="UTF-8"?>' + '<?xml version="1.0" encoding="UTF-8"?>' +
'<bpmn:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' + '<bpmn:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' +
@ -118,6 +120,10 @@ inherits(Modeler, Viewer);
module.exports = Modeler; module.exports = Modeler;
module.exports.Viewer = Viewer;
module.exports.NavigatedViewer = NavigatedViewer;
/** /**
* Create a new diagram to start modeling. * Create a new diagram to start modeling.
* *

View File

@ -399,4 +399,16 @@ describe('Modeler', function() {
}); });
it('should expose Viewer and NavigatedViewer', function() {
// given
var Viewer = require('../../lib/Viewer');
var NavigatedViewer = require('../../lib/NavigatedViewer');
// then
expect(Modeler.Viewer).to.equal(Viewer);
expect(Modeler.NavigatedViewer).to.equal(NavigatedViewer);
});
}); });