Open qwenger opened 2 years ago
When I originally created this library, I did the bare minimum for it to be useful in production. The API was deliberately kept small to reduce the likelihood of bugs. However, I don't use it in production any more, so if you wish to make it easier to use, we can do so. Just make sure everything including failures/exceptions is covered by tests.
What about add_callable? Should Object also support it? Should we merge set and add_callable?
May be a good idea to merge them, yes.
What about having a more transparent interface between JS and Python? Like being able to access properties of Object with the standard dot syntax (and/or square brackets lookup?)?
I like this. Can be implemented in Python code as a convenience.
What about add_callable? Should Object also support it? Should we merge set and add_callable?
May be a good idea to merge them, yes.
Could you please have a look at #82? It is an alternative proposal that goes further by merging set
and add_callable
and moving the get
/set
methods to Object.
Implement
Object.get
andObject.set
using the same ideas asContext.get
andContext.set
.Currently it is very tedious to get or set an object property. When the object is only known via its Python wrapper, one has to first rebind it to the global context using
Context.set
and then access it withContext.get
. With this, one could directly access or set the property via the Python wrapper.The
json()
method is not sufficient for this, as it does not expose properties from the prototype.Discussion:
get
,set
, etc. methods of Context, add a genericget_global
or similar to get the global object from the context)Further discussion (for the future?):
add_callable
? Should Object also support it? Should we mergeset
andadd_callable
?