Function quickjs_runtime::features::setimmediate::init

source ·
pub fn init(q_js_rt: &QuickJsRuntimeAdapter) -> Result<(), JsError>
Expand description

provides the setImmediate methods for the runtime

§Example

use quickjs_runtime::builder::QuickJsRuntimeBuilder;
use quickjs_runtime::jsutils::Script;
use std::time::Duration;
let rt = QuickJsRuntimeBuilder::new().build();
rt.eval_sync(None, Script::new("test_immediate.es", "setImmediate(() => {console.log('immediate logging')});")).expect("script failed");
std::thread::sleep(Duration::from_secs(1));