Skip to main content

JS_SetInterruptHandler

Function JS_SetInterruptHandler 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn JS_SetInterruptHandler( rt: *mut JsRuntime, cb: InterruptHandler, opaque: *mut c_void, )
Expand description

JS_SetInterruptHandler: call cb periodically while a script runs.

Returning non-zero from the callback aborts the script. The engine checks the handler at the sites it already yields at (loop back-edges and calls), which is enough for “stop this runaway script” and not enough for single-stepping — see the README’s limitations section, where that is stated as the reason debugger is not implemented on top of it.

§Safety

rt must be a live runtime and cb, if non-null, a JSInterruptHandler.