A sneak peek into the framework that I am using:
<script type="text/javascript">
document.addListener('DOMContentLoaded', function() {
AE.Bridge.get('settings').then(function (settings) {
// Do initialization and stuff with settings.
}, function (error) {
// Handle error or display error message
});
}
</script>
Such a mechanism avoids having separate onload() and set_value() since they belong together. It also avoids fishing an onCompleted out of the function signature (as SketchUp does and assumes it’s intended for callback). Logic and control flow stays in JavaScript, and Ruby just answers requests without knowing about or caring about the order (no onload).
Now I have been polishing this framework for too long, and parts of it have been solved by HtmlDialog, but it could maybe be of interest for others?
It is controversial what the right “look” of an application is (and, if the main app would be HTML/JS based, it would be critisized not being “native”). Ideally it would use the system’s native styling (raw elements without CSS), but since Chromium and other web browsers transitioned to using their corporate style instead of calling the system’s theming engine, this approach is obsolete.
Should I imitate native styling with CSS (but then it would be hard-coded to look like a specific theme on a specific OS, and not match when the theme is changed)? Should I invent my own style and make it look inconsistent? Should I imitate SketchUp’s corporate style? Should I use a neutral style?