2024-02-24 21:00:04 +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, " ")
|
|
|
|
}
|
|
|
|
|
2024-04-04 14:46:14 +00:00
|
|
|
func builtinConsoleLog(call FunctionCall) Value {
|
2024-02-24 21:00:04 +00:00
|
|
|
fmt.Fprintln(os.Stdout, formatForConsole(call.ArgumentList))
|
|
|
|
return Value{}
|
|
|
|
}
|
|
|
|
|
2024-04-04 14:46:14 +00:00
|
|
|
func builtinConsoleError(call FunctionCall) Value {
|
2024-02-24 21:00:04 +00:00
|
|
|
fmt.Fprintln(os.Stdout, formatForConsole(call.ArgumentList))
|
|
|
|
return Value{}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Nothing happens.
|
2024-04-04 14:46:14 +00:00
|
|
|
func builtinConsoleDir(call FunctionCall) Value {
|
2024-02-24 21:00:04 +00:00
|
|
|
return Value{}
|
|
|
|
}
|
|
|
|
|
2024-04-04 14:46:14 +00:00
|
|
|
func builtinConsoleTime(call FunctionCall) Value {
|
2024-02-24 21:00:04 +00:00
|
|
|
return Value{}
|
|
|
|
}
|
|
|
|
|
2024-04-04 14:46:14 +00:00
|
|
|
func builtinConsoleTimeEnd(call FunctionCall) Value {
|
2024-02-24 21:00:04 +00:00
|
|
|
return Value{}
|
|
|
|
}
|
|
|
|
|
2024-04-04 14:46:14 +00:00
|
|
|
func builtinConsoleTrace(call FunctionCall) Value {
|
2024-02-24 21:00:04 +00:00
|
|
|
return Value{}
|
|
|
|
}
|
|
|
|
|
2024-04-04 14:46:14 +00:00
|
|
|
func builtinConsoleAssert(call FunctionCall) Value {
|
2024-02-24 21:00:04 +00:00
|
|
|
return Value{}
|
|
|
|
}
|