Send message between javascript and App

Hi, have developed an App which loads files from the Bundle directory to the Documents directory when the App boots up. The index file (index.html) on the App copies these files to the Documents directory and serves them from there. The index page needs to talk to the Native app code to monitor the progress. I am using this code to get an update on the file copy progress:


This sends the progress to the javascript on the index.html page


This code on the index.html page talks to the native code on the App

WKScriptMessage – window.webkit.messageHandlers.updateProgress.postMessage(message)

My problem is;

When the app starts loading the pages the code above does not get fired until the files are all copied

Is there a better way for the App to talk to the index.html page as the code is running?

Powered by WPeMatico


You may also like...

Comments are closed.