mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:38:11 +00:00
LibJS: Replace the global print() function with console.log() :^)
This commit is contained in:
parent
19452230cd
commit
086f68e878
10 changed files with 109 additions and 25 deletions
|
@ -6,17 +6,12 @@
|
|||
#include <LibJS/Runtime/GlobalObject.h>
|
||||
#include <LibJS/Runtime/NativeFunction.h>
|
||||
#include <LibJS/Runtime/Value.h>
|
||||
#include <stdio.h>
|
||||
|
||||
namespace JS {
|
||||
|
||||
GlobalObject::GlobalObject()
|
||||
{
|
||||
put_native_function("print", [](Object*, Vector<Value> arguments) -> Value {
|
||||
for (auto& argument : arguments)
|
||||
printf("%s ", argument.to_string().characters());
|
||||
return js_undefined();
|
||||
});
|
||||
put("console", heap().allocate<ConsoleObject>());
|
||||
put_native_function("gc", [](Object* this_object, Vector<Value>) -> Value {
|
||||
dbg() << "Forced garbage collection requested!";
|
||||
this_object->heap().collect_garbage();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue