最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Native OS X apps in JS? - Stack Overflow

programmeradmin4浏览0评论

I would like to write an application in JavsScript that runs natively on OS X. It would be a bonus if it could be used for Windows apps as well, however I am primarily interested in the OS X / Cocoa tie in initially.

I was entertaining the possibility of writing all of the business logic in JS and then the primary UI ponents with Cocoa and .NET respectively, but I got to thinking that it would be nice if there were something already in place that would facilitate such a workflow without having to support a few different codebases.

After researching this a bit, I obviously became overwhelmed with the solutions that seem to exist for iOS development, however hitherto I've found nothing that really seems to also work on OS X. Are there any solutions that I may be overlooking? If not, what might be the remended path for basing most business logic in a JavaScript app and interfacing with that for the native UI ponents?

I would like to write an application in JavsScript that runs natively on OS X. It would be a bonus if it could be used for Windows apps as well, however I am primarily interested in the OS X / Cocoa tie in initially.

I was entertaining the possibility of writing all of the business logic in JS and then the primary UI ponents with Cocoa and .NET respectively, but I got to thinking that it would be nice if there were something already in place that would facilitate such a workflow without having to support a few different codebases.

After researching this a bit, I obviously became overwhelmed with the solutions that seem to exist for iOS development, however hitherto I've found nothing that really seems to also work on OS X. Are there any solutions that I may be overlooking? If not, what might be the remended path for basing most business logic in a JavaScript app and interfacing with that for the native UI ponents?

Share Improve this question asked Jun 5, 2013 at 19:06 ylluminateylluminate 12.4k17 gold badges82 silver badges161 bronze badges 2
  • I guess you could make a simple app that is just a fullscreen web browser without an address bar or something, then download the HTML and CSS and JS in your app then automatically set the web browser to go to the main HTML page on startup – tckmn Commented Jun 5, 2013 at 19:11
  • crx web apps for chrome, manifests for firefox, and adobe AIR are all cross-platform dev environments using JS that will work on mac and pc. – dandavis Commented Jun 5, 2013 at 19:23
Add a ment  | 

2 Answers 2

Reset to default 5

This is being a hot topic. I suggest you read this article about a JavaScript Objective-C bridge for OS 10.9. Also, check out this code sample from Apple in which the application controller is simply responsible for municating between objects and JavaScript is really driving everything. The sample is called JavaScriptCoreHeadstart and Apple describes it as follows:

JavaScriptCore is a new system framework available in Mac OS X 10.5 that allows applications to run JavaScripts. This sample shows one way to use JavaScriptCore for providing user configurable features in a Cocoa application. Here, a number of JavaScript objects are defined that represent various parts of the application and the application's controller is really just a thin shell that calls JavaScripts that decide how the application will operate in response to Interface Builder action method calls and WebKit delegate callbacks. The JavaScripts themselves control the application through the objects that represent different parts of the application.

There is NodObjC that should allow you to write Cocoa applications for NodeJS.

发布评论

评论列表(0)

  1. 暂无评论