Documentation.

This commit is contained in:
Josh Matthews 2015-03-05 11:19:58 -05:00
parent 7b3043a59b
commit d0704d1797
2 changed files with 6 additions and 2 deletions

View file

@ -130,8 +130,9 @@ impl<'a> GlobalRef<'a> {
} }
} }
/// `ScriptChan` used to send messages to the event loop of this global's /// Create a new sender/receiver pair that can be used to implement an on-demand
/// thread. /// event loop. Used for implementing web APIs that require blocking semantics
/// without resorting to nested event loops.
pub fn new_script_pair(&self) -> (Box<ScriptChan+Send>, Box<ScriptPort+Send>) { pub fn new_script_pair(&self) -> (Box<ScriptChan+Send>, Box<ScriptPort+Send>) {
match *self { match *self {
GlobalRef::Window(ref window) => window.new_script_pair(), GlobalRef::Window(ref window) => window.new_script_pair(),

View file

@ -201,6 +201,9 @@ pub trait ScriptChan {
fn clone(&self) -> Box<ScriptChan+Send>; fn clone(&self) -> Box<ScriptChan+Send>;
} }
/// 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 { pub trait ScriptPort {
fn recv(&self) -> ScriptMsg; fn recv(&self) -> ScriptMsg;
} }