From d0704d17970987a1b96f1e4d6a50aae986542435 Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Thu, 5 Mar 2015 11:19:58 -0500 Subject: [PATCH] Documentation. --- components/script/dom/bindings/global.rs | 5 +++-- components/script/script_task.rs | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/components/script/dom/bindings/global.rs b/components/script/dom/bindings/global.rs index bff4c66f89b..3c3df454ca1 100644 --- a/components/script/dom/bindings/global.rs +++ b/components/script/dom/bindings/global.rs @@ -130,8 +130,9 @@ impl<'a> GlobalRef<'a> { } } - /// `ScriptChan` used to send messages to the event loop of this global's - /// thread. + /// Create a new sender/receiver pair that can be used to implement an on-demand + /// event loop. Used for implementing web APIs that require blocking semantics + /// without resorting to nested event loops. pub fn new_script_pair(&self) -> (Box, Box) { match *self { GlobalRef::Window(ref window) => window.new_script_pair(), diff --git a/components/script/script_task.rs b/components/script/script_task.rs index e43ca69a981..31116307b3c 100644 --- a/components/script/script_task.rs +++ b/components/script/script_task.rs @@ -201,6 +201,9 @@ pub trait ScriptChan { fn clone(&self) -> Box; } +/// An interface for receiving ScriptMsg values in an event loop. Used for synchronous DOM +/// APIs that need to abstract over multiple kinds of event loops (worker/main thread) with +/// different Receiver interfaces. pub trait ScriptPort { fn recv(&self) -> ScriptMsg; }