node.js 예제를 보다 보면
분명히(?) client side인데 require가 있어서 보는 중..
require.js로 JS들을 조건부 load 할 수 있다고 하는데...
[링크 : https://requirejs.org/docs/commonjs.html]
AMD는 Asynchronous Module Definition (비동기 모듈 정의) 규칙이다.
[링크 : https://blog.pigno.se/post/157992405313]
// EITHER - accessing modules with <script> tags var WaveSurfer = window.WaveSurfer; var TimelinePlugin = window.WaveSurfer.timeline; var MinimapPlugin = window.WaveSurfer.minimap; // OR - importing as es6 module import WaveSurfer from 'wavesurfer.js'; import TimelinePlugin from 'wavesurfer.js/dist/plugin/wavesurfer.timeline.min.js'; import MinimapPlugin from 'wavesurfer.js/dist/plugin/wavesurfer.minimap.min.js'; // OR - importing as require.js/commonjs modules var WaveSurfer = require('wavesurfer.js'); var TimelinePlugin = require('wavesurfer.js/dist/plugin/wavesurfer.timeline.min.js'); var MinimapPlugin = require('wavesurfer.js/dist/plugin/wavesurfer.minimap.min.js'); // ... initialising waveform with plugins var wavesurfer = WaveSurfer.create({ container: '#waveform', waveColor: 'violet', plugins: [ TimelinePlugin.create({ container: '#wave-timeline' }), MinimapPlugin.create() ] }); |
'Programming > javascript & HTML' 카테고리의 다른 글
js object array sort by key (0) | 2018.11.21 |
---|---|
wavesurfer.js 그리고 HE-AACv2 (0) | 2018.11.21 |
[Violation] 'setInterval' handler took (0) | 2018.11.18 |
JSON.stringify() 주의사항(?) (0) | 2018.11.17 |
canvas to input type=file formdata (0) | 2018.11.15 |