4 ms·
Wow apple is embracing javascript
by snyp 11y ago
Wow apple is embracing javascript
- rimantas 11y agoHow is this news?
- jonknee 11y agoBecause they don't do that for iOS, MacOS or watchOS? The last time they did something similar was for Dashboard Widgets and that was 10 years ago.
- polpo 11y agoAFAIK, the "Channels" on the Apple TV gen 2 and 3 are already JavaScript and XML-based (a while ago, people discovered that they could spoof the XML and JS on the Trailers channel to play arbitrary videos). So it's somewhat natural that the new Apple TV continues with Javascript.
- glasshead969 11y agoApple introduced Native JavaScript bridge for iOS in iOS 7. you can call objective-c apis in javascript.[1] [1]https://developer.apple.com/library/mac/documentation/AppleApplications/Conceptual/SafariJSProgTopics/Tasks/ObjCFromJavaScript.html https://developer.apple.com/library/mac/documentation/AppleA...
- jonknee 11y agoThat's not what this is about though, it's for UI layout (much like with Dashboard). You don't call Objective-C APIs from JS inside a WebKit container, you're actually using JS to layout the app. Update: the docs are up and the JS framework is called TVJS, https://developer.apple.com/library/prerelease/tvos/documentation/TVMLJS/Reference/TVJSFrameworkReference/index.html https://developer.apple.com/library/prerelease/tvos/document...
- glasshead969 11y agoJavaScriptCore framework gives full access to JS runtime.https://www.bignerdranch.com/blog/javascriptcore-and-ios-7/ https://www.bignerdranch.com/blog/javascriptcore-and-ios-7/
- draw_down 11y agoThe docs say you use something called "TVML" to lay out the UI, and inside the TVML you can have JS. I think.
- jonknee 11y agoTVML for layout and TVJS for logic. TVML is just an XML schema for Apple TV UIs and TVJS a Javascript framework to present the XML templates loaded with your data. If you're wanting to stream video you can build a full app with almost no Obj-C/Swift (there's still a small shell, though probably nothing custom needs to be here). The XML templates are a little odd in that they're JS files (e.g. Index.xml.js) and contain the XML as the return value of a global function called Template. It seems really straight forward though.
- deleted 11y ago[deleted]
- jonknee 11y agoIt's a fine use of XML. JSON would be a kludge. The templates look like this: <lockup> <img src="${this.BASEURL}resources/images/music/music_570_e1.lcr" width="450" height="450" /> <title class="showTextOnHighlight">Title 1</title> </lockup>
- thomasfoster96 11y agoI wonder if they're being processed as ES6 Template Strings?
- Tloewald 11y agoYou can write native apps in Javascript on the Mac. You can use Javascript from the command line out of the box in OSX.
- deleted 11y ago[deleted]