Module port

Source

Enumsยง

Port
Port abstracts over the different Javascript types that support sending and receiving messages. We need to abstract over these types since there is no trait available to describe this interface. Moreover, some of these interfaces have slightly different semantics, e.g., we need to call web_sys::MessagePort::start for the web_sys::MessagePort. The inner variants are wrapped in an Rc so that we can force a worker to terminate when we drop the last instance. Unfortunately, the browser does not seem to reliably terminate workers during garbage collection.