Skip to content

Latest commit

 

History

History
29 lines (22 loc) · 1.03 KB

File metadata and controls

29 lines (22 loc) · 1.03 KB

Load Local BPMN Diagrams

Javascript example

♻️ Usage

Tips: you can use BPMN diagrams available in this repository in the bpmn-files folder.

Let's assume that a bpmnVisualization variable has already been initialized and the inputFileHtmlElement variable relates to the input file html element.
The content of the selected file is loaded as BPMN diagram which is rendered on the page.

inputFileHtmlElement.addEventListener('change', handleFileSelect, false);

function handleFileSelect(evt) {
    evt.stopPropagation();
    evt.preventDefault();

    const file = evt.target.files[0];
    const reader = new FileReader();
    reader.onload = () => {
        bpmnVisualization.load(reader.result);
    };
    reader.readAsText(file);
}