Sunday, May 29, 2016

Making Paw Extensible With JavaScript Core

Micha Mazaheri:

There was a dilemma on the choice of the scripting language. Sketch exposes an CocoaScript interface that lets users mix JavaScript with a syntax inspired by Objective-C, and gives access to all available OS X APIs. This would have been a serious security concern for Paw being a place where developers may store their production server credentials: letting 3rd party have unrestricted access to the app didn’t feel right.

[…]

Since OS X 10.9 / iOS 7, the JavaScript Core framework exposes great Objective-C to JavaScript bindings (it had a C API before). This meant objects from either language would be bridged to the other by just following a simple protocol and following a few rules for memory management. The whole thing would run in a JavaScript Virtual Machine we would fully control. We would create JavaScript APIs to let 3rd parties safely access the data we wanted to expose.

Comments RSS · Twitter

Leave a Comment