* src/CMakeLists.txt: Also generate a custom Also generate a custom webkit2gtk-web-extension-4.0 VAPI that re-includes javascriptcore objects, so they can be access from the web extension. * bindings/metadata/WebKit2WebExtension-4.0-custom.vala, bindings/metadata/WebKit2WebExtension-4.0.metadata: Include in-tree metadata for web extension VAPI, update to all access to JS obejcts. * bindings/vapi/javascriptcore-4.0.vapi: Add a bunch of useful additional objects and method.
73 lines
2.4 KiB
Vala
73 lines
2.4 KiB
Vala
/* javascriptcore-4.0.vapi. */
|
|
|
|
[CCode (cprefix = "JS", gir_namespace = "JavaScriptCore", gir_version = "4.0", lower_case_cprefix = "JS_", cheader_filename = "JavaScriptCore/JavaScript.h")]
|
|
namespace JS {
|
|
|
|
[CCode (cname = "JSGlobalContextRef")]
|
|
[SimpleType]
|
|
public struct GlobalContext : Context {
|
|
|
|
[CCode (cname = "JSValueIsBoolean")]
|
|
public bool is_boolean(JS.Value value);
|
|
|
|
[CCode (cname = "JSValueIsNumber")]
|
|
public bool is_number(JS.Value value);
|
|
|
|
[CCode (cname = "JSValueToBoolean")]
|
|
public bool to_boolean(JS.Value value);
|
|
|
|
[CCode (cname = "JSValueToNumber")]
|
|
public double to_number(JS.Value value, out JS.Value exception);
|
|
|
|
[CCode (cname = "JSGlobalContextRelease")]
|
|
public bool release();
|
|
}
|
|
|
|
[CCode (cname = "JSContextRef")]
|
|
[SimpleType]
|
|
public struct Context {
|
|
|
|
[CCode (cname = "JSEvaluateScript")]
|
|
public Value evaluate_script(String script,
|
|
Object? thisObject,
|
|
String? sourceURL,
|
|
int startingLineNumber,
|
|
out Value? exception);
|
|
|
|
[CCode (cname = "JSObjectMakeFunction")]
|
|
public Object make_function(String? name,
|
|
[CCode (array_length_pos=1.5)]
|
|
String[]? parameterNames,
|
|
String body,
|
|
String? sourceURL,
|
|
int startingLineNumber,
|
|
out Value? exception);
|
|
|
|
[CCode (cname = "JSObjectCallAsFunction")]
|
|
public Value call_as_function(Object object,
|
|
Object? thisObject,
|
|
[CCode (array_length_pos=2.5)]
|
|
Value[]? arguments,
|
|
out Value? exception);
|
|
|
|
}
|
|
|
|
[CCode (cname = "JSObjectRef")]
|
|
[SimpleType]
|
|
public struct Object {
|
|
}
|
|
|
|
[CCode (cname = "JSValueRef")]
|
|
[SimpleType]
|
|
public struct Value {
|
|
}
|
|
|
|
[CCode (cname = "JSStringRef", ref_function = "JSStringRetain", unref_function = "JSStringRelease")]
|
|
[SimpleType]
|
|
public struct String {
|
|
|
|
[CCode (cname = "JSStringCreateWithUTF8CString")]
|
|
public String.create_with_utf8_cstring(string str);
|
|
|
|
}
|
|
}
|