Skip to content

Debugging JavaScript

bang edited this page Nov 10, 2015 · 4 revisions

We can use Safari Web Inspector to debug JSPatch script in iOS8 +:

###Run

To start using Web Inspector, you must first enable the Develop menu:

Safari -> Preference -> Advanced -> Enable the "Show Develop menu in menu bar"

Then start your APP -> Open Safari -> Develop menu -> Choose your device -> JSContext to debug JSPatch script.

If you try to connect your device instead of Simulator, you should enable the Web Inspector in you device: System Setting -> Safari -> Advance -> enable the "Web Inspector".

For more information of Web Inspector, please see the official documents.

###Resource list

Resources will list all JSPatch script files executed, open these files you can add debugger into it.

If you execute script through [JPEngine evaluateScript:script], it will show as main.js in resource list.

If you execute script through [JPEngine evaluateScriptWithPath:filePath], it will show as the original name of the JS file in resource list.

Clone this wiki locally