Skip to content

Commit 5da1ffa

Browse files
authored
Remove unused argument from autoResumeAudioContext (#25697)
There are 3 callers of this function internally, and non of them pass more than one arg. This fixes a TODO from 2022.
1 parent 8096632 commit 5da1ffa

File tree

2 files changed

+4
-11
lines changed

2 files changed

+4
-11
lines changed

src/lib/libcore.js

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1711,16 +1711,9 @@ addToLibrary({
17111711
// input events on, and registers a context resume() for them. This lets
17121712
// audio work properly in an automatic way, as browsers won't let audio run
17131713
// without user interaction.
1714-
// If @elements is not provided, we default to the document and canvas
1715-
// elements, which handle common use cases.
1716-
// TODO(sbc): Remove seemingly unused elements argument
1717-
$autoResumeAudioContext__docs: '/** @param {Array<Object>=} elements */',
1718-
$autoResumeAudioContext: (ctx, elements) => {
1719-
if (!elements) {
1720-
elements = [document, document.getElementById('canvas')];
1721-
}
1714+
$autoResumeAudioContext: (ctx) => {
17221715
for (var event of ['keydown', 'mousedown', 'touchstart']) {
1723-
for (var element of elements) {
1716+
for (var element of [document, document.getElementById('canvas')]) {
17241717
element?.addEventListener(event, () => {
17251718
if (ctx.state === 'suspended') ctx.resume();
17261719
}, { 'once': true });

test/codesize/test_codesize_hello_dylink_all.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"a.out.js": 245496,
2+
"a.out.js": 245483,
33
"a.out.nodebug.wasm": 574067,
4-
"total": 819563,
4+
"total": 819550,
55
"sent": [
66
"IMG_Init",
77
"IMG_Load",

0 commit comments

Comments
 (0)