diff options
author | Yoshiya Hinosawa <stibium121@gmail.com> | 2019-01-07 06:34:52 +0900 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2019-01-06 16:34:52 -0500 |
commit | cae71ed8416cba63a2be8c9068b3a3e0b148a32a (patch) | |
tree | 1c6ed1b3dbb9fd65f02fd39d32fa627dc9d7f04b /libdeno/binding.cc | |
parent | 1b7938e3aa0ba1fb7ad7d6699f01cbf3c8a4196c (diff) |
Implement console.groupCollapsed (#1452)
This implementation of groupCollapsed is intentionally different
from the spec defined by whatwg. See the conversation in #1355
and #1363.
Diffstat (limited to 'libdeno/binding.cc')
-rw-r--r-- | libdeno/binding.cc | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libdeno/binding.cc b/libdeno/binding.cc index da3ce198d..cbeeee1e9 100644 --- a/libdeno/binding.cc +++ b/libdeno/binding.cc @@ -191,7 +191,7 @@ void PromiseRejectCallback(v8::PromiseRejectMessage promise_reject_message) { void Print(const v8::FunctionCallbackInfo<v8::Value>& args) { CHECK_GE(args.Length(), 1); - CHECK_LE(args.Length(), 2); + CHECK_LE(args.Length(), 3); auto* isolate = args.GetIsolate(); DenoIsolate* d = FromIsolate(isolate); auto context = d->context_.Get(d->isolate_); @@ -199,9 +199,13 @@ void Print(const v8::FunctionCallbackInfo<v8::Value>& args) { v8::String::Utf8Value str(isolate, args[0]); bool is_err = args.Length() >= 2 ? args[1]->BooleanValue(context).ToChecked() : false; + bool prints_newline = + args.Length() >= 3 ? args[2]->BooleanValue(context).ToChecked() : true; FILE* file = is_err ? stderr : stdout; fwrite(*str, sizeof(**str), str.length(), file); - fprintf(file, "\n"); + if (prints_newline) { + fprintf(file, "\n"); + } fflush(file); } |