feat(example): re-export artifacts after change only

Closes #11
This commit is contained in:
Nico Rehwaldt 2014-03-26 17:46:02 +01:00
parent 42b63d7111
commit c723d43184
4 changed files with 15 additions and 12 deletions

View File

@ -1,4 +1,4 @@
(function(BpmnJS) {
(function(BpmnJS, $) {
var container = $('#js-drop-zone');
@ -42,6 +42,8 @@
.removeClass('with-error')
.addClass('with-diagram');
}
});
}
@ -131,7 +133,9 @@
}
}
setInterval(function() {
var _ = require('lodash');
var exportArtifacts = _.debounce(function() {
saveSVG(function(err, svg) {
setEncoded(downloadSvgLink, 'diagram.svg', err ? null : svg);
@ -140,8 +144,9 @@
saveDiagram(function(err, xml) {
setEncoded(downloadLink, 'diagram.bpmn', err ? null : xml);
});
}, 500);
}, 5000);
renderer.on('commandStack.changed', exportArtifacts);
});
})(window.BpmnJS);
})(window.BpmnJS, window.jQuery);

BIN
example/fontawesome.woff Normal file

Binary file not shown.

View File

@ -6,7 +6,6 @@
<link rel="stylesheet" href="app.css" />
<link rel="stylesheet" href="diagram-js.css" />
<link rel="stylesheet" href="http://fontawesome.io/assets/font-awesome/css/font-awesome.css" />
</head>
<body>
<div class="content" id="js-drop-zone">
@ -35,13 +34,13 @@
<ul class="buttons">
<li>
<a id="js-download-diagram" href title="download">
<i class="fa fa-download fa-3"></i>
<a id="js-download-diagram" href title="download BPMN diagram">
<i class="fa fa-download fa-3x"></i>
</a>
</li>
<li>
<a id="js-download-svg" href title="download as svg">
<i class="fa fa-code fa-3"></i>
<a id="js-download-svg" href title="download as SVG image">
<i class="fa fa-picture-o fa-3x"></i>
</a>
</li>
</ul>

View File

@ -6,7 +6,6 @@
<link rel="stylesheet" href="../app.css" />
<link rel="stylesheet" href="../diagram-js.css" />
<link rel="stylesheet" href="http://fontawesome.io/assets/font-awesome/css/font-awesome.css" />
</head>
<body>
<div class="content" id="js-drop-zone">
@ -36,12 +35,12 @@
<ul class="buttons">
<li>
<a id="js-download-diagram" href title="download">
<i class="fa fa-download fa-3"></i>
<i class="fa fa-download fa-3x"></i>
</a>
</li>
<li>
<a id="js-download-svg" href title="download as svg">
<i class="fa fa-code fa-3"></i>
<i class="fa fa-picture-o fa-3x"></i>
</a>
</li>
</ul>