diff options
| author | Caleb Mabry <36182383+caleb-mabry@users.noreply.github.com> | 2022-03-23 15:32:20 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-03-23 15:32:20 -0400 |
| commit | a726bdd00060876be91b6b3f134ecc6867bbeed6 (patch) | |
| tree | 228ef1f017ce0320f3d210a557d2803a03ec73e1 /webAO/components | |
| parent | 2e734ec14fc760f80e2a9dc81cdf9269220bb791 (diff) | |
| parent | 46d63b5ba4eeb30ac1f5add49b03b1aed8ae0328 (diff) | |
Merge pull request #119 from caleb-mabry/moving-audio-channels
Moving Audio Channels to HTML Elements
Diffstat (limited to 'webAO/components')
| -rw-r--r-- | webAO/components/__tests__/audioChannels.test.js | 9 | ||||
| -rw-r--r-- | webAO/components/audioChannels.js | 13 |
2 files changed, 22 insertions, 0 deletions
diff --git a/webAO/components/__tests__/audioChannels.test.js b/webAO/components/__tests__/audioChannels.test.js new file mode 100644 index 0000000..243d870 --- /dev/null +++ b/webAO/components/__tests__/audioChannels.test.js @@ -0,0 +1,9 @@ +import createAudioChannels from "../audioChannels"; + +describe('createAudioChannels', () => { + test('Should create 4 channels', () => { + document.body.innerHTML = '' + createAudioChannels(4) + expect(document.getElementsByClassName('audioChannel').length).toBe(4) + }) +})
\ No newline at end of file diff --git a/webAO/components/audioChannels.js b/webAO/components/audioChannels.js new file mode 100644 index 0000000..1979653 --- /dev/null +++ b/webAO/components/audioChannels.js @@ -0,0 +1,13 @@ +/** + * + * @param {number} amountOfChannels Amount of Blips to put on page + */ +const createAudioChannels = (amountOfChannels) => { + for (let i = 0; i < amountOfChannels; i++) { + const audioChannel = document.createElement('audio') + audioChannel.setAttribute('class', 'audioChannel') + document.body.appendChild(audioChannel) + } +} +createAudioChannels(4) +export default createAudioChannels |
