mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Move WebIDL methods to traits implemented by JSRef types.
This commit is contained in:
parent
dfdda0098a
commit
76783b029e
106 changed files with 3644 additions and 1912 deletions
|
@ -23,24 +23,34 @@ impl Console {
|
|||
pub fn new(window: &JSRef<Window>) -> Unrooted<Console> {
|
||||
reflect_dom_object(~Console::new_inherited(), window, ConsoleBinding::Wrap)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn Log(&self, message: DOMString) {
|
||||
pub trait ConsoleMethods {
|
||||
fn Log(&self, message: DOMString);
|
||||
fn Debug(&self, message: DOMString);
|
||||
fn Info(&self, message: DOMString);
|
||||
fn Warn(&self, message: DOMString);
|
||||
fn Error(&self, message: DOMString);
|
||||
}
|
||||
|
||||
impl<'a> ConsoleMethods for JSRef<'a, Console> {
|
||||
fn Log(&self, message: DOMString) {
|
||||
println!("{:s}", message);
|
||||
}
|
||||
|
||||
pub fn Debug(&self, message: DOMString) {
|
||||
fn Debug(&self, message: DOMString) {
|
||||
println!("{:s}", message);
|
||||
}
|
||||
|
||||
pub fn Info(&self, message: DOMString) {
|
||||
fn Info(&self, message: DOMString) {
|
||||
println!("{:s}", message);
|
||||
}
|
||||
|
||||
pub fn Warn(&self, message: DOMString) {
|
||||
fn Warn(&self, message: DOMString) {
|
||||
println!("{:s}", message);
|
||||
}
|
||||
|
||||
pub fn Error(&self, message: DOMString) {
|
||||
fn Error(&self, message: DOMString) {
|
||||
println!("{:s}", message);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue