aboutsummaryrefslogtreecommitdiff
path: root/webAO/components
diff options
context:
space:
mode:
authorCaleb Mabry <36182383+caleb-mabry@users.noreply.github.com>2022-03-23 15:31:04 -0400
committerGitHub <noreply@github.com>2022-03-23 15:31:04 -0400
commit46d63b5ba4eeb30ac1f5add49b03b1aed8ae0328 (patch)
tree228ef1f017ce0320f3d210a557d2803a03ec73e1 /webAO/components
parent0b6b4b085cee48248fe2025a2514252ee20ee774 (diff)
parent2e734ec14fc760f80e2a9dc81cdf9269220bb791 (diff)
Merge branch 'master' into moving-audio-channels
Diffstat (limited to 'webAO/components')
-rw-r--r--webAO/components/__tests__/blips.test.js9
-rw-r--r--webAO/components/blip.js17
2 files changed, 26 insertions, 0 deletions
diff --git a/webAO/components/__tests__/blips.test.js b/webAO/components/__tests__/blips.test.js
new file mode 100644
index 0000000..9c57e78
--- /dev/null
+++ b/webAO/components/__tests__/blips.test.js
@@ -0,0 +1,9 @@
+import createBlip from "../blip";
+
+describe('createBlip', () => {
+ test('create 3 blips audios', () => {
+ document.body.innerHTML = ``
+ createBlip(3)
+ expect(document.getElementsByClassName('blipSound').length).toBe(3)
+ })
+}) \ No newline at end of file
diff --git a/webAO/components/blip.js b/webAO/components/blip.js
new file mode 100644
index 0000000..eacbeaf
--- /dev/null
+++ b/webAO/components/blip.js
@@ -0,0 +1,17 @@
+import AO_HOST from '../client/aoHost'
+
+/**
+ *
+ * @param {number} amountOfBlips Amount of Blips to put on page
+ */
+const createBlip = (amountOfBlips) => {
+ for (let i = 0; i < amountOfBlips; i++) {
+ const audio = document.createElement('audio')
+ const blipUrl = `${AO_HOST}sounds/general/sfx-blipmale.opus`
+ audio.setAttribute('class', 'blipSound')
+ audio.setAttribute('src', blipUrl)
+ document.body.appendChild(audio)
+ }
+}
+createBlip(6)
+export default createBlip \ No newline at end of file