More Related Content


TypeScript for Alfresco and CMIS - Alfresco DevCon 2012 San Jose

  1. TypeScript for Alfresco and CMIS Steve Reiner CTO Integrated Semantics
  2. JS++ Search • Seeking something close to ActionScript that can translate to JavaScript • Close to ActionScript would make it easier to port ActionScript in multiple large Flex applications (FlexSpaces, CMIS Spaces, FlexibleDashbord) and ActionScript libraries (such as Grebulon XMLA OLAP) to this JS++ • By being ActionScript like, would also be a good productive language for large apps (static typing, class syntax, interfaces,etc.) • Also like IDEs / intellisense (Flash Builder, etc.)
  3. JS++ Search • Use ActionScript and translate to JavaScript • Jangaroo Compiler and ActionScript API to ExtJS developed by CoreMedia AG • FalconJS from Adobe (Adobe is slow in getting this to Apache Flex, still not available) • Approach not taking off with developers, better things coming along: Dart and TypeScript • Dart from Google • Nice language, nice html and core libraries, good IDE with integrated debugging, can use on server too • InterOp with JavaScript is awkward and more work • Only “modern web browsers” supported (not old versions) • Others: Haxe, Opa, JavaScript++, CoffeeScript, etc.
  4. TypeScript • Despite coming from Micro$oft (hold your nose) its actually seems like the best approach • Extends JavaScript, all JavaScript code is valid TypeScript (Dart is JavaScript like, but still a new language) • Open Source (Apache 2.0) • Using coming ECMAScript 6 for parts it has (class and interfaces), adding typing and modules • Optional typing like Dart • Can use for node.js serverside code, tsc cmd line compiler can install as node.js pkg (compiler written in typescript)
  5. TypeScript • Can have typed interface wrapper for existing JavaScript libraries in declaration / definition files (d.ts) without having to modify original js library files • Seeing good bit of existing javascript libraries have typescript definition files created within 2-3 weeks after TypeScript was announced was very impressive (see DefinitelyTyped repo in github) (compared to slow pace of libraries being ported to Dart) • Note: TypeScript is in Preview phase, not final, but since output-ed JavaScript is JavaScript and no runtime libs there is somewhat less risk
  6. TypeScript IDES • Visual Studio 2012 with TypeScript plugin • Can debug TypeScript code in VS and run in IE • Can debug in debuggers in recent Chrome and FireFox (need to manually add –sourcemap to tsc build line in VS project files) • Free Express version of Visual Studio 2012 can be used (WebEssentials plugin with side compare JS feature can’t be used in the express version) • Also MS WebMatrix can be used, syntax files for Sublime Text, Vi, and Emacs. • JetBrains IntelliJ IDEA EAP has some support • No Eclipse yet (thought Dart Editor could be changed to work with TypeScript)
  7. TypeScript Alfreso and CMIS apis • Will have a TypeScript definition wrapper for AlfJS by DevCon SJ • Will have a basic TypeScript defnition wrapper for any CMIS.JS Alfresco has • Also could have a CMIS api with interfaces and classes more like the Java OpenCMIS client apis • In porting CMIS Spaces libraries could port the as3 atompub code if CMIS.JS doesn’t happen or it is only for the cmis browser binding • Also will try and have TypeScript for Alfresco Cloud APIs • In porting FlexSpaces to TypeScript will initially use custom webscripts it has. • Then will change to be able to use subset of features without custom webscripts (use webscripts in place for Share, thus a TypeScript wrapped more full featured AlfJS)
  8. TypeScript based Clients / App Components • Plan to port both FlexSpaces and CMIS Spaces to TypeScript • Modify Jangaroo Compiler to do AS3 -> TypeScript • Use YUI3 and some other JS frameworks thru TS defn wrappers • HTML5/JS in browser, PhoneGap mobile, and AIR/JS (for desktop drag in/out,native clipboard, offline file syncing, etc.) packagings • Support Alfresco Cloud too?
  9. TypeScript Dashlets / WebScripts • If there is interest: • Share Dashlet clientside code: will try to put together a sample dashlet done in TypeScript with TS defn wrappers for YUI 2.x, some wrappers for Share base components, etc. • Thus get intellisense and type checking in IDES. • The YAHOO.extend of YUI components may be a little tricky. • Share WebScripts: since TS compiles to JS you could use it for basic webscripts • Alfresco WebScripts: It may be possible to have TS definition file for what root scope objects and typed apis are available from this env
  10. Links to Find out more • • • Introducing-TypeScript • • • • blog • • Twitter: @stevereiner