mirror of
https://github.com/RGBCube/serenity
synced 2025-05-15 09:34:59 +00:00
LibJS: Set length property in Object::put_native_function()
This commit is contained in:
parent
b3c4514902
commit
cd3e2690eb
14 changed files with 25 additions and 23 deletions
|
@ -155,9 +155,11 @@ void Object::put(const FlyString& property_name, Value value)
|
|||
put_own_property(*this, property_name, value);
|
||||
}
|
||||
|
||||
void Object::put_native_function(const FlyString& property_name, AK::Function<Value(Interpreter&)> native_function)
|
||||
void Object::put_native_function(const FlyString& property_name, AK::Function<Value(Interpreter&)> native_function, i32 length)
|
||||
{
|
||||
put(property_name, heap().allocate<NativeFunction>(move(native_function)));
|
||||
auto* function = heap().allocate<NativeFunction>(move(native_function));
|
||||
function->put("length", Value(length));
|
||||
put(property_name, function);
|
||||
}
|
||||
|
||||
void Object::put_native_property(const FlyString& property_name, AK::Function<Value(Interpreter&)> getter, AK::Function<void(Interpreter&, Value)> setter)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue