Skip to content

Remove MainLoop.method. NFC#26254

Merged
sbc100 merged 1 commit intoemscripten-core:mainfrom
sbc100:MainLoop_method
Feb 13, 2026
Merged

Remove MainLoop.method. NFC#26254
sbc100 merged 1 commit intoemscripten-core:mainfrom
sbc100:MainLoop_method

Conversation

@sbc100
Copy link
Collaborator

@sbc100 sbc100 commented Feb 12, 2026

The MainLoop.method property seems to be a string version of MainLoop.timingMode.

It had exactly one user which was to generate a warning. The warning was firing in the case when the method was timeout (which is the same as timingMode == EM_TIMING_SETTIMEOUT). The warning code would then reset MainLoop.method so that it would only fire "once per set main loop". However, since this was changed to warnOnce in #10090, the warning actually only fires once per program run.

The `MainLoop.method` property seems to be a string version of
`MainLoop.timingMode`.

It had exactly one user which was to generate a warning. The warning was
firing in the case when the method was `timeout` (which is the same as
`timingMode` == `EM_TIMING_SETTIMEOUT`).  The warning code would then
reset `MainLoop.method` so that it would only fire "once per set main
loop".  However, since this was changed to `warnOnce` in emscripten-core#10090, the
warning actually only fires once per program run.
@sbc100 sbc100 requested a review from kripken February 12, 2026 21:02
warnOnce('Looks like you are rendering without using requestAnimationFrame for the main loop. You should use 0 for the frame rate in emscripten_set_main_loop in order to use requestAnimationFrame, as that can greatly improve your frame rates!');
}
#endif
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks wrong - now the warning only happens for timingMode = SETTIMEOUT?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but that was true before this change too.

Before: check MainLoop.method === 'timeout'
After: check MainLoop.timingMode == EM_TIMING_SETTIMEOUT

But these checks are the same thing since method is only set to timeout then timeingMode is EM_TIMING_SETTIMEOUT

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, right, now I see.

warnOnce('Looks like you are rendering without using requestAnimationFrame for the main loop. You should use 0 for the frame rate in emscripten_set_main_loop in order to use requestAnimationFrame, as that can greatly improve your frame rates!');
}
#endif
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, right, now I see.

@sbc100 sbc100 merged commit 8c5f431 into emscripten-core:main Feb 13, 2026
36 checks passed
@sbc100 sbc100 deleted the MainLoop_method branch February 13, 2026 00:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants