2015-02-16 13:28:33 +00:00
|
|
|
package otto
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"os"
|
|
|
|
"strings"
|
|
|
|
)
|
|
|
|
|
|
|
|
func formatForConsole(argumentList []Value) string {
|
|
|
|
output := []string{}
|
|
|
|
for _, argument := range argumentList {
|
|
|
|
output = append(output, fmt.Sprintf("%v", argument))
|
|
|
|
}
|
|
|
|
return strings.Join(output, " ")
|
|
|
|
}
|
|
|
|
|
|
|
|
func builtinConsole_log(call FunctionCall) Value {
|
|
|
|
fmt.Fprintln(os.Stdout, formatForConsole(call.ArgumentList))
|
2015-03-20 12:22:01 +00:00
|
|
|
return Value{}
|
2015-02-16 13:28:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func builtinConsole_error(call FunctionCall) Value {
|
|
|
|
fmt.Fprintln(os.Stdout, formatForConsole(call.ArgumentList))
|
2015-03-20 12:22:01 +00:00
|
|
|
return Value{}
|
2015-02-16 13:28:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Nothing happens.
|
|
|
|
func builtinConsole_dir(call FunctionCall) Value {
|
2015-03-20 12:22:01 +00:00
|
|
|
return Value{}
|
2015-02-16 13:28:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func builtinConsole_time(call FunctionCall) Value {
|
2015-03-20 12:22:01 +00:00
|
|
|
return Value{}
|
2015-02-16 13:28:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func builtinConsole_timeEnd(call FunctionCall) Value {
|
2015-03-20 12:22:01 +00:00
|
|
|
return Value{}
|
2015-02-16 13:28:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func builtinConsole_trace(call FunctionCall) Value {
|
2015-03-20 12:22:01 +00:00
|
|
|
return Value{}
|
2015-02-16 13:28:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func builtinConsole_assert(call FunctionCall) Value {
|
2015-03-20 12:22:01 +00:00
|
|
|
return Value{}
|
2015-02-16 13:28:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (runtime *_runtime) newConsole() *_object {
|
|
|
|
|
|
|
|
return newConsoleObject(runtime)
|
|
|
|
}
|