diff --git a/lib/Modeler.js b/lib/Modeler.js index c5aecf9a..8d7c6b20 100644 --- a/lib/Modeler.js +++ b/lib/Modeler.js @@ -1,5 +1,7 @@ 'use strict'; +var inherits = require('inherits'); + var IdSupport = require('bpmn-moddle/lib/id-support'), Ids = require('ids'); @@ -36,7 +38,7 @@ function Modeler(options) { Viewer.call(this, options); } -Modeler.prototype = Object.create(Viewer.prototype); +inherits(Modeler, Viewer); Modeler.prototype.createDiagram = function(done) { return this.importXML(initialDiagram, done); diff --git a/lib/NavigatedViewer.js b/lib/NavigatedViewer.js index 2b50086c..3593fbc6 100644 --- a/lib/NavigatedViewer.js +++ b/lib/NavigatedViewer.js @@ -1,5 +1,7 @@ 'use strict'; +var inherits = require('inherits'); + var Viewer = require('./Viewer'); @@ -12,7 +14,7 @@ function NavigatedViewer(options) { Viewer.call(this, options); } -NavigatedViewer.prototype = Object.create(Viewer.prototype); +inherits(NavigatedViewer, Viewer); module.exports = NavigatedViewer; diff --git a/lib/draw/BpmnRenderer.js b/lib/draw/BpmnRenderer.js index 43bc90ed..896eaf0e 100644 --- a/lib/draw/BpmnRenderer.js +++ b/lib/draw/BpmnRenderer.js @@ -1,6 +1,7 @@ 'use strict'; -var isArray = require('lodash/lang/isArray'), +var inherits = require('inherits'), + isArray = require('lodash/lang/isArray'), isObject = require('lodash/lang/isObject'), assign = require('lodash/object/assign'), forEach = require('lodash/collection/forEach'), @@ -1510,7 +1511,7 @@ function BpmnRenderer(events, styles, pathMap) { this.drawConnection = drawConnection; } -BpmnRenderer.prototype = Object.create(DefaultRenderer.prototype); +inherits(BpmnRenderer, DefaultRenderer); BpmnRenderer.$inject = [ 'eventBus', 'styles', 'pathMap' ]; diff --git a/lib/features/modeling/ElementFactory.js b/lib/features/modeling/ElementFactory.js index 2d2860c4..0a7b643f 100644 --- a/lib/features/modeling/ElementFactory.js +++ b/lib/features/modeling/ElementFactory.js @@ -1,6 +1,7 @@ 'use strict'; -var assign = require('lodash/object/assign'); +var assign = require('lodash/object/assign'), + inherits = require('inherits'); var BaseElementFactory = require('diagram-js/lib/core/ElementFactory'), LabelUtil = require('../../util/Label'); @@ -16,7 +17,8 @@ function ElementFactory(bpmnFactory, moddle) { this._moddle = moddle; } -ElementFactory.prototype = Object.create(BaseElementFactory.prototype); +inherits(ElementFactory, BaseElementFactory); + ElementFactory.$inject = [ 'bpmnFactory', 'moddle' ]; diff --git a/lib/features/modeling/Layouter.js b/lib/features/modeling/Layouter.js index c730a18d..462de07c 100644 --- a/lib/features/modeling/Layouter.js +++ b/lib/features/modeling/Layouter.js @@ -1,5 +1,7 @@ 'use strict'; +var inherits = require('inherits'); + var BaseLayouter = require('diagram-js/lib/features/modeling/Layouter'), LayoutUtil = require('diagram-js/lib/layout/Util'), ManhattanLayout = require('diagram-js/lib/layout/ManhattanLayout'); @@ -7,7 +9,7 @@ var BaseLayouter = require('diagram-js/lib/features/modeling/Layouter'), function Layouter() {} -Layouter.prototype = Object.create(BaseLayouter.prototype); +inherits(Layouter, BaseLayouter); module.exports = Layouter; diff --git a/lib/features/modeling/Modeling.js b/lib/features/modeling/Modeling.js index db50ecb0..9a0d2d9e 100644 --- a/lib/features/modeling/Modeling.js +++ b/lib/features/modeling/Modeling.js @@ -1,5 +1,7 @@ 'use strict'; +var inherits = require('inherits'); + var BaseModeling = require('diagram-js/lib/features/modeling/Modeling'); var UpdatePropertiesHandler = require('./cmd/UpdatePropertiesHandler'); @@ -16,12 +18,13 @@ function Modeling(eventBus, elementFactory, commandStack) { BaseModeling.call(this, eventBus, elementFactory, commandStack); } -Modeling.prototype = Object.create(BaseModeling.prototype); +inherits(Modeling, BaseModeling); Modeling.$inject = [ 'eventBus', 'elementFactory', 'commandStack' ]; module.exports = Modeling; + Modeling.prototype.getHandlers = function() { var handlers = BaseModeling.prototype.getHandlers.call(this); diff --git a/lib/features/modeling/rules/ModelingRules.js b/lib/features/modeling/rules/ModelingRules.js index 839593f5..56b620c3 100644 --- a/lib/features/modeling/rules/ModelingRules.js +++ b/lib/features/modeling/rules/ModelingRules.js @@ -2,7 +2,8 @@ var groupBy = require('lodash/collection/groupBy'), size = require('lodash/collection/size'), - forEach = require('lodash/collection/forEach'); + forEach = require('lodash/collection/forEach'), + inherits = require('inherits'); var RuleProvider = require('diagram-js/lib/features/rules/RuleProvider'); @@ -11,12 +12,12 @@ function ModelingRules(eventBus) { RuleProvider.call(this, eventBus); } +inherits(ModelingRules, RuleProvider); + ModelingRules.$inject = [ 'eventBus' ]; module.exports = ModelingRules; -ModelingRules.prototype = Object.create(RuleProvider.prototype); - ModelingRules.prototype.init = function() { diff --git a/package.json b/package.json index 81baf9b0..7b3dd451 100644 --- a/package.json +++ b/package.json @@ -60,6 +60,7 @@ "diagram-js-direct-editing": "^0.9.0", "didi": "^0.0.4", "ids": "^0.1.0", + "inherits": "^2.0.1", "lodash": "^3.0.1", "min-dom": "^0.2.0", "object-refs": "^0.1.0"