debian-mirror-gitlab/app/assets/javascripts/blob/balsamiq_viewer.js
2018-03-27 19:54:05 +05:30

19 lines
501 B
JavaScript

import Flash from '../flash';
import BalsamiqViewer from './balsamiq/balsamiq_viewer';
function onError() {
const flash = new Flash('Balsamiq file could not be loaded.');
return flash;
}
export default 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);
}