-
Notifications
You must be signed in to change notification settings - Fork 684
[Proposal] Introduce new jerry-ext methods to ease method/property registration #2715
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I wonder whether this proposal could be merged into jerry-ext/handler somehow? That extension module contains oft-used native function implementations and a helper to register them into the global object. Couldn't that be extended with helper(s) to register functions 'elsewhere', too? (Property registration would be a bit of an outlier in jerry-ext/handler, I know. At least the name "handler" doesn't seem to fit perfectly.) |
I have no objection to have this function. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO when you using the Jerry API you always write similar registration functions for yourself for each type so the necessity of these functions is unquestionable. I belive that is the motivation of the PR so I higly support this idea.
0f5daba
to
14b8219
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In overall I think the basics are good now.
bc33cf2
to
2198bdd
Compare
1b5f638
to
c1fc4e8
Compare
New methods * jerryx_set_properties: Allows multiple property registration for via a single call * jerryx_set_property_str: Allows property registration without the need to create the property name JS value. The property name can be directly passed as a `const char*` value and must be zero terminated. * jerryx_get_property_str: Allows getting a property value on a given object. The property name can be directly passed as a `const char*` value. * jerryx_has_property_str: Allows checking if a property exists on a given object. JerryScript-DCO-1.0-Signed-off-by: Peter Gal [email protected]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
New methods
create the property name JS value. The property name can be directly passed
as a
const char*
value and must be zero terminated.