How to build timeline pagination?



I play with the mastodon api and try to build timeline pagination in javascript, but don’t understand how to use since_id and max_id (with limit).

Haven’t found a example yet. Could someone help me?


Seems to be easier as I thought before…

Just get the ID of the oldest toot in the current timeline and use it for ‘max_id’ (combined with a limit) to load older toots.