I'm trying to do JavaScript bindings and this is the syntax I have in mind to access native code:
- Code: Select all
import { TestClass } from "sdk://test";
TestClass.doSomething();
I've gotten to the point where I register the sdk protocol handler, then thought I'd feed it this as a resource:
- Code: Select all
export class TestClass {
static doSomething() {
native function doSomething();
doSomething();
}
};
But then I realized handlers can only be registered using CefRegisterExtension.
Now I would like to know how I could go with the above syntax, or something similar.
I am attempting to expose tons of classes to JavaScript and they can easily have 4-5 namespaces, and usage such as "sdk.namespace1.namespace2.namespace3.TestClass" would be a little bit annoying.
The import syntax seems much more neat.
One way I thought of doing is registering extensions with long names such as NativeProxy_SdkNamespace1Namespace2Namespace3TestClass
and then instead of using "native" in the above code snippet, I would just call these "NativeProxy_" functions.
Is there a better way to do this though? I've tried to search for this kind of thing, but it's very hard to find anything.