Embedded OS X applications in JS?

I would like to write an application in JavsScript that runs initially on OS X. It will be a bonus if it can also be used for Windows applications, however, I am primarily interested in the OS X / Cocoa relationship at the initial stage.

I took the opportunity to write all the business logic in JS, and then the main components of the user interface with Cocoa and .NET, respectively, but I thought it would be nice if there was something already existing that would facilitate such a workflow without supporting several different code bases.

After a little research on this issue, I obviously overwhelmed with the solutions that seem to exist for iOS development, but so far I have not found anything that really looks like working with OS X. Are there any solutions that I can ignore? If not, what is the recommended way to base most business logic in a JavaScript application and interact with it for your own user interface components?

+6
source share
2 answers

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

JavaScriptCore is a new system infrastructure available on Mac OS X 10.5 that allows you to run JavaScripts applications. This example shows one way to use JavaScriptCore to provide user-customizable features in a Cocoa application. A number of JavaScript objects are defined here that represent the various parts of the application and the application controller β€” it's just a thin shell that invokes JavaScripts that decide how the application will work in response to the Interface Builder action method calls and WebKit delegate callbacks. JavaScripts scripts themselves control the application through objects that represent different parts of the application.

+5
source

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

+2
source

Source: https://habr.com/ru/post/946613/


All Articles