Comments (3)
How about something like this?
pub fn define<K: ToValue<'ducc>>(&self, key: K, desc: PropertyDescriptor<'ducc>) -> Result<()> { ... }
struct PropertyDescriptor<'ducc> {
enumerable: bool,
configurable: bool,
writable: bool,
value: Option<Value<'ducc>>,
get: Option<Function<'ducc>>,
set: Option<Function<'ducc>>,
}
// Optionally hook up with `duk_get_prop_desc`:
// pub fn definition<K: ToValue<'ducc>>(&self, key: K) -> Result<PropertyDescriptor<'ducc>> { ... }
PropertyDescriptor
should probably implement the builder pattern. DUK_DEFPROP_FORCE
is available but isn't part of the descriptor metadata per se. It could be a function parameter like Object::define(&self, key, desc, force: bool)
or it could just be never/always set in the inner duk_def_prop
call. (Depends on your needs. ducc only implements what its users need it to do, it doesn't aim to preemptively cover all use cases.)
My plate is full with other work right now but I'd happily review/advise on any work you do here!
from ducc.
Okay, created preliminary PR at #12
from ducc.
Closed by #12. A new version ducc 0.1.5
has been published.
Thanks for your contributions!!
from ducc.
Related Issues (11)
- Undefined symbols for architecture x86_64: "DUK_VARARGS" HOT 6
- Store Ducc values inside userdata HOT 4
- Idea: object (and function?) handle
- Support for modules? HOT 2
- Can we mutate userdata entry inside a JS invoked function? HOT 4
- Use `DUK_USE_DATE_NOW_WINDOWS` flag for Windows 7 support HOT 5
- Support multiple Duktape contexts with a shared heap HOT 4
- Add support for arm HOT 2
- Warnings When Compiling on Stable
- Unhandled fatal error causes stack overflow HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ducc.