jstime_core 0.66.0

Another JS Runtime
Documentation
pub(crate) fn get_external_references() -> Vec<v8::ExternalReference> {
    vec![
        v8::ExternalReference {
            function: v8::MapFnTo::map_fn_to(streams_enqueue_chunk),
        },
        v8::ExternalReference {
            function: v8::MapFnTo::map_fn_to(streams_close_stream),
        },
        v8::ExternalReference {
            function: v8::MapFnTo::map_fn_to(streams_error_stream),
        },
    ]
}

pub(crate) fn register_bindings(scope: &mut v8::PinScope, bindings: v8::Local<v8::Object>) {
    let name = v8::String::new(scope, "streamsEnqueueChunk").unwrap();
    let value = v8::Function::new(scope, streams_enqueue_chunk).unwrap();
    bindings.set(scope, name.into(), value.into());

    let name = v8::String::new(scope, "streamsCloseStream").unwrap();
    let value = v8::Function::new(scope, streams_close_stream).unwrap();
    bindings.set(scope, name.into(), value.into());

    let name = v8::String::new(scope, "streamsErrorStream").unwrap();
    let value = v8::Function::new(scope, streams_error_stream).unwrap();
    bindings.set(scope, name.into(), value.into());
}

// Placeholder function for enqueuing chunks
fn streams_enqueue_chunk(
    _scope: &mut v8::PinScope,
    _args: v8::FunctionCallbackArguments,
    _rv: v8::ReturnValue,
) {
    // This is a placeholder - actual implementation would involve
    // managing stream state and queuing chunks
}

// Placeholder function for closing stream
fn streams_close_stream(
    _scope: &mut v8::PinScope,
    _args: v8::FunctionCallbackArguments,
    _rv: v8::ReturnValue,
) {
    // This is a placeholder - actual implementation would involve
    // managing stream state
}

// Placeholder function for erroring stream
fn streams_error_stream(
    _scope: &mut v8::PinScope,
    _args: v8::FunctionCallbackArguments,
    _rv: v8::ReturnValue,
) {
    // This is a placeholder - actual implementation would involve
    // managing stream state and error handling
}