Trying to understand how infinite scrolling works in Discourse

I’ve gathered so far that if Javascript is turned off, then pagination is turned on by something in the server-side code. I intend to identify what code produces that and investigate how to selectively activate it.