Add web worker JS API (#1993)

* Refactored the way worker polling is scheduled and errors are handled.
* Share the worker future as a Shared
This commit is contained in:
andy finch 2019-04-01 15:09:59 -04:00 committed by Ryan Dahl
parent 659acadf77
commit b0a23beb8f
28 changed files with 1013 additions and 257 deletions

View file

@ -305,7 +305,8 @@ pub fn add_worker(wc: WorkerChannels) -> Resource {
Resource { rid }
}
pub fn worker_post_message(
/// Post message to worker as a host or privilged overlord
pub fn post_message_to_worker(
rid: ResourceId,
buf: Buf,
) -> futures::sink::Send<futures::sync::mpsc::Sender<Buf>> {
@ -341,7 +342,7 @@ impl Future for WorkerReceiver {
}
}
pub fn worker_recv_message(rid: ResourceId) -> WorkerReceiver {
pub fn get_message_from_worker(rid: ResourceId) -> WorkerReceiver {
WorkerReceiver { rid }
}