debian-mirror-gitlab/app/assets/javascripts/blob/balsamiq_viewer.js

23 lines
505 B
JavaScript
Raw Normal View History

2017-09-10 17:25:29 +05:30
/* global Flash */
2017-08-17 22:00:37 +05:30
import BalsamiqViewer from './balsamiq/balsamiq_viewer';
2017-09-10 17:25:29 +05:30
function onError() {
const flash = new window.Flash('Balsamiq file could not be loaded.');
return flash;
}
function loadBalsamiqFile() {
const viewer = document.getElementById('js-balsamiq-viewer');
if (!(viewer instanceof Element)) return;
const endpoint = viewer.dataset.endpoint;
const balsamiqViewer = new BalsamiqViewer(viewer);
balsamiqViewer.loadFile(endpoint).catch(onError);
}
$(loadBalsamiqFile);