Checking similar JS Engine like the QJSEngine the QJSValue has a function that allows calling the javascript function, but this behavior is not supported by KJS.
I created this patch as I applied for GSoC this year with Okular to the project: Support animated pdf
A sample of the javascript code we need to run could be found here: LINK
So we need to support setInterval which can be done by using QTimer and when timeout signal is emitted we could call the required function.