赞助

在 BPMN.js 中,$inject 属性通常用于声明依赖注入的模块列表。这些模块会在创建对象实例时由依赖注入框架(如 AngularJS)提供。以下是在 BPMN.js 中常见的一些 $inject 属性:

  1. BpmnModeler 构造函数的 $inject
 
BpmnModeler.$inject = ['eventBus', 'canvas', /* ... other dependencies ... */];

BpmnModeler 是 BPMN 模型编辑器的主要构造函数。在实例化 BpmnModeler 对象时,这些依赖将被注入。

  1. ElementFactory 构造函数的 $inject
 
ElementFactory.$inject = ['eventBus', /* ... other dependencies ... */];

ElementFactory 用于创建 BPMN 元素的工厂。在实例化 ElementFactory 对象时,这些依赖将被注入。

  1. ContextPadProvider 构造函数的 $inject
 
ContextPadProvider.$inject = ['config.contextPad', 'injector', 'contextPad', 'modeling', 'elementFactory', 'connect', 'create', 'translate', 'canvas', 'popupMenu'];

ContextPadProvider 是 BPMN 模型中右键上下文菜单的提供者。在实例化 ContextPadProvider 对象时,这些依赖将被注入。

  1. PaletteProvider 构造函数的 $inject
 
PaletteProvider.$inject = ['palette', 'create', 'elementFactory', 'handTool', 'lassoTool', 'spaceTool', 'globalConnect', 'translate'];

PaletteProvider 是 BPMN 模型中的调色板提供者。在实例化 PaletteProvider 对象时,这些依赖将被注入。

这些例子只是展示了一些 BPMN.js 中可能用到的构造函数的 $inject 属性。具体的依赖注入列表可能因库的不同而有所变化。

posted on 2023-11-16 17:53  Tsunami黄嵩粟  阅读(57)  评论(0编辑  收藏  举报