I am currently building and angular2 application (TypeScript) and want to embed the bpmn viewer, where I have hit a hard wall. I should say I have quite some experience writing software, but I am completely new to web development and lack a lot of the necessary technical background that I seem to need in order to solve this on my own.
What I ultimately want is to have a Viewer reference on typescript level that I can work with. But these are my conceptual problems:
- I cannot import the library on code level. I installed it via npm, but there are no type definitions (d.ts file) and so the usual workarounds to “import” the library on typescript level fail. I can’t just declare a var : any aimed at Viewer from Viewer.js, because typescript cannot handle the “require” statements contained therein. Is there anyone who has ever done this?
- I do not understand the structure of the library as it is. The code example (https://github.com/bpmn-io/bpmn-js-examples/tree/master/simple-commonjs) creates a “BpmnViewer” handle via “var BpmnViewer = require(‘bpmn-js’);”. Does this refer to the stuff defined in Viewer.js? What kind of magic does “require” wield at this point? How can I mimick this behaviour by hand?
Sorry for such low-level questions, but being able to use bpmn-js in upcoming angular2 projects would certainly be quite cool…