简体   繁体   English

跨平台桌面应用程序的最佳JavaScript引擎

[英]best javascript engine for cross platform desktop app

I am going to create a desktop app, with C++ as backend, Html/JS as UI. 我将创建一个桌面应用程序,以C ++作为后端,以Html / JS作为UI。 for now, it just hosted by QtWebKit to cross platform, maybe in future, may be hosted on line. 目前,它只是由QtWebKit托管以跨平台,也许将来可能会在线托管。

Is QtWebKit is a good approach? QtWebKit是一个好方法吗? the interface will be signal/slot, not sure whether it easy to port to other javascript engine when porting to website? 接口将是信号/插槽,不确定在移植到网站时是否易于移植到其他JavaScript引擎?

any ideas on this? 有什么想法吗? thanks in advance. 提前致谢。

I've successfully used Mozilla's SpiderMonkey in a cross-platform C++ application (32 and 64 bit Windows and Ubuntu) and it worked out quite well. 我已经在跨平台的C ++应用程序(32位和64位Windows和Ubuntu)中成功使用了Mozilla的SpiderMonkey,并且效果很好。 I don't really understand your question details/description though... 我真的不太了解您的问题详细信息/说明...

If you keep each slot 'simple' (as in literally just doing UI stuff with your business logic being handled in an instanced business logic class), it should be trivial to port this to the web later on. 如果您使每个插槽保持“简单”状态(就像从字面上做UI一样,而您的业务逻辑在实例化的业务逻辑类中进行处理),那么稍后将其移植到Web上将是微不足道的。

I would suggest you NOT do it this way if you're going to be trying to port it to the web. 如果您要尝试将其移植到网络上,我建议您不要这样做。 The reasoning being that you're going to have to re implement your backend(which currently will be done in c++ in your app) in a server language (either php, .NET, python, RoR, etc...). 原因是您将必须以服务器语言(php,.net,python,RoR等)重新实现后端(当前将在应用程序中以c ++完成)。

If you're looking for an 'easy' way to do this work once for a web interface AND a cross-platform Qt c++ app, I'd look to doing all of your business logic at a server app while still using the QtWebkit as your front-end. 如果您正在寻找一种“简单”的方法来针对Web界面和跨平台的Qt c ++应用程序一次完成此工作,那么我希望在服务器应用程序中执行所有业务逻辑,同时仍将QtWebkit用作您的前端。 It's trivial with Qt to do HTTP requests(GET and POST) and get/parse json/html. 使用Qt进行HTTP请求(GET和POST)并获取/解析json / html并不容易。

This will allow you to very easily replace the slot mechanism with any JS event driven framework (I use jQuery). 这将使您可以非常轻松地用任何JS事件驱动的框架(我使用jQuery)替换插槽机制。 This will also not force you to 'port' the back-end logic. 这也不会迫使您“移植”后端逻辑。

This also has the additional benefit of being able to be used for mobile applications if you're ever thinking about going that way as well. 如果您也考虑过这样做的话,这还具有可以用于移动应用程序的其他好处。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM