mirror of
https://github.com/sartography/bpmn-js.git
synced 2025-02-02 12:13:42 +00:00
docs(README): add how to use
This commit is contained in:
parent
f09002e54a
commit
c672e2e442
29
README.md
29
README.md
@ -6,6 +6,35 @@ bpmn-js is the BPMN 2.0 diagram modeling and rendering toolkit that powers [bpmn
|
||||
> bpmn-js is in an alpha stage, expect documentation to be missing and examples to be broken.
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
Get the library via [npm](http://npmjs.org)
|
||||
|
||||
```
|
||||
npm install --save bpmn-js
|
||||
```
|
||||
|
||||
Use it in your project
|
||||
|
||||
```javascript
|
||||
var BpmnViewer = require('bpmn-js').Viewer;
|
||||
|
||||
var xml; // my BPMN 2.0 xml
|
||||
var viewer = new BpmnViewer({ container: 'body' });
|
||||
|
||||
viewer.importXML(xml, function(err) {
|
||||
|
||||
if (err) {
|
||||
console.log('error rendering', err);
|
||||
} else {
|
||||
console.log('rendered');
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
Make sure to bundle the project for the browser, e.g. by using [browserify](http://browserify.org).
|
||||
|
||||
|
||||
## Resources
|
||||
|
||||
* [Demo](http://demo.bpmn.io)
|
||||
|
Loading…
x
Reference in New Issue
Block a user