Skip to main content

construct_message_channel

Function construct_message_channel 

Source
pub fn construct_message_channel(_args: &[Value]) -> Result<Value, String>
Expand description

new MessageChannel() → { port1, port2 }, two MessagePort objects linked so that port1.postMessage(v) is delivered to port2 (and vice versa). Both ports live on the calling thread and share its heap; messages are cloned through the JSON subset (serialize/deserialize) so a posted object is a copy, not a shared reference — matching structured clone’s copy semantics. Requires the parent to wire MessageChannel construction (see the report).