Skip to content
This repository was archived by the owner on Feb 21, 2018. It is now read-only.
This repository was archived by the owner on Feb 21, 2018. It is now read-only.

About JS API abstract #17

Closed
Closed
@magicfish2007

Description

@magicfish2007

Recently, I am interesting in abstracing JS API, and have some general idea after comparing APIs between v8, jsc, chakra and spidermonkey. Hence, I have some issues about JS API(not include node-api temporarily).

  1. c OR c++ form?
    jsc, chakra and spidermonkey API are all written in C, while v8.h is written in C++. Of cause, C++ maybe more friendly to C++ programme(include add-on developer) , but C would be less consume and more like JNI.
  2. only one type OR many data types
    I have see some data types's abstract to review:
    (https://github.com/nodejs/api/blob/master/native/data_types.md)
    Is this a final design? What about abstract many data types, such as JSObject JSFunction JSNumber ..., as what JNI did?
  3. how to deal with persistent in v8(or global ref in else JS Engine)?
    Is there any necessary to define a data type named "GlobalValue" to indicate a persistent data which is rooted? We all know that in JNI, there is no data type like above, so many developer with JNI would confuse about whether this data is local or not.
  4. wrap c++ class
    I find that JSC and Spidermonkey provide a API to wrap a c++ class written by developer , and map to a JS object, so that they can new a JS object in JS file, with a C++ construct. For example, in JSC, they define a class with JSClassDefinition, and define a class with JSClassCreate, so they can use it in JS. Should the JS API provide this feature?
  5. argument check
    Is there any necessary to provide a argument check just like check_jni.h in Dalvik/art in Android?
  6. InternalField
    InternalField in v8 ,external data in chakra or Private in spidermoneky can store a pointer to C++ object for native developer, but this is easy to lead to memory leak(i.e developer forget to release the object binding to a JS object). What can JS API do for this situation?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions