3 ms·
> with most memory being allocated by the JavaScriptCore VM If I'm writing a green-field HTML5 app, and I don't derive any benefit from Javascript, is the inte
by derefr 8y ago
> with most memory being allocated by the JavaScriptCore VM
If I'm writing a green-field HTML5 app, and I don't derive any benefit from Javascript, is the interface between Ultralight and JavaScriptCore clean enough to just rip out the JS support altogether, replacing it with something simpler?
I'm picturing:
1. I embed Ultralight into a process that exposes a simple script-loading API, ala the one in JSCore;
2. I write HTML with no <script> elements, just elements with onclick/ontouch/etc. handler attrs, where these handlers just contain a UUID;
3. Ultralight passes the "script code" (i.e. the UUID) to my trivial script-loading API, which simply looks up a native handler based on the provided UUID, and returns its function pointer;
4. Ultralight holds onto that function pointer and treats it just like a regular thunkable Javascript handler function pointer.
In other words, all the "dynamism" of the HTML would be handled by native, static code in my compiled binary, with the only thing being set up at runtime being the binding of DOM elements to those known-at-compile-time native handlers. The QML/XAML/NIB approach.
- c-smile 8y agoJust in case you can do that with Sciter already. In your CSS to define div.my { behavior:my-widget; } While loading HTML that contains <div class="my"> you will get SC_ATTACH_BEHAVIOR callback with the DOM event handler reference. By handling SC_ATTACH_BEHAVIOR you will return DOM event handler (a.k.a. behavior) - just a native function pointer that receives all DOM events on that element: mouse, keyboard, etc. That's the same mechanism as HWND and WndProc but with lightweight DOM elements instead of Windows. Example of such behavior that implements panels with tabs container: https://github.com/c-smile/sciter-sdk/blob/master/include/behaviors/behavior_tabs.cpp https://github.com/c-smile/sciter-sdk/blob/master/include/be...
- adamjs 8y agoInteresting, it's not too farfetched of an idea since there is a C++ API for accessing the DOM in WebCore and we have the ability to disable JS completely. I've added this to the issue tracker as an idea to explore. [1] [1] - https://github.com/ultralight-ux/ultralight/issues/14 https://github.com/ultralight-ux/ultralight/issues/14