Skip to content

Commit 1056790

Browse files
committed
feat: add interrupt handler for JS execution
1 parent 1e23a0a commit 1056790

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/context/context.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,14 @@ impl Context {
538538
}
539539
}
540540

541+
/// Set the interrupt handler.\
542+
/// Return != 0 if the JS code needs to be interrupted.
543+
pub fn set_interrupt_handler(&self, func: q::JSInterruptHandler, opaque: *mut c_void) {
544+
unsafe {
545+
q::JS_SetInterruptHandler(self.runtime, func, opaque);
546+
}
547+
}
548+
541549
/// Call a global function in the Javascript namespace.
542550
///
543551
/// **Promises**:

0 commit comments

Comments
 (0)