diff options
author | Mike Greiling <mike@pixelcog.com> | 2018-03-01 02:11:07 -0600 |
---|---|---|
committer | Mike Greiling <mike@pixelcog.com> | 2018-03-01 11:29:26 -0600 |
commit | 9d9d0105947e4cc23f150135e0c904d6ad31f315 (patch) | |
tree | 92c7f7dcf5d1b079e5e39d66832d05d1f8b1ca05 /app/assets/javascripts/blob | |
parent | 4e86a7378cd96ffebfb1c128c9fcb614ee479ffe (diff) | |
download | gitlab-ce-9d9d0105947e4cc23f150135e0c904d6ad31f315.tar.gz |
migrate sketch_viewer to dynamic import
Diffstat (limited to 'app/assets/javascripts/blob')
-rw-r--r-- | app/assets/javascripts/blob/sketch_viewer.js | 4 | ||||
-rw-r--r-- | app/assets/javascripts/blob/viewer/index.js | 3 |
2 files changed, 5 insertions, 2 deletions
diff --git a/app/assets/javascripts/blob/sketch_viewer.js b/app/assets/javascripts/blob/sketch_viewer.js index 0640dd26855..2c1c6339fdb 100644 --- a/app/assets/javascripts/blob/sketch_viewer.js +++ b/app/assets/javascripts/blob/sketch_viewer.js @@ -1,8 +1,8 @@ /* eslint-disable no-new */ import SketchLoader from './sketch'; -document.addEventListener('DOMContentLoaded', () => { +export default () => { const el = document.getElementById('js-sketch-viewer'); new SketchLoader(el); -}); +}; diff --git a/app/assets/javascripts/blob/viewer/index.js b/app/assets/javascripts/blob/viewer/index.js index b227cf38920..ac18e6fb9f9 100644 --- a/app/assets/javascripts/blob/viewer/index.js +++ b/app/assets/javascripts/blob/viewer/index.js @@ -38,6 +38,9 @@ export default class BlobViewer { case 'pdf': initViewer(import(/* webpackChunkName: 'pdf_viewer' */ '../pdf_viewer')); break; + case 'sketch': + initViewer(import(/* webpackChunkName: 'sketch_viewer' */ '../sketch_viewer')); + break; default: break; } |