TypeScript for Alfresco and CMIS - Alfresco DevCon 2012 San Jose


Published on

This presentation was given during the second Lightning Talk session at the Alfresco DevCon 2012 in San Jose. This briefly covered some languages that can be translated to JavaScript (TypeScript, Dart, ActionScript, CoffeeScript) and used for developing HTML5/JS web applications and mobile web apps. TypeScript seems to be the best choice. IDEs and editors currently supporting TypeScript were listed.

My plans to support various Alfresco and CMIS things was covered: port CMIS Spaces and FlexSpaces from Flex/AS3 to TypeScript, TypeScript wrappers for AlfJS and CMIS.JS, additional Alfresco and CMIS TypeScript libraries, sample showing a Share dashlet, and a TypeScript definition file for intellisense / compile time type checking for Alfresco WebScripts.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

TypeScript for Alfresco and CMIS - Alfresco DevCon 2012 San Jose

  1. 1. TypeScript for Alfresco and CMIS Steve Reiner CTO Integrated Semantics
  2. 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. 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. 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. 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. 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. 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. 8. TypeScript based Clients / AppComponents • 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. 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. 10. Links to Find out more • http://www.typescriptlang.org/ • http://www.typescriptlang.org/Playground/ • http://channel9.msdn.com/posts/Anders-Hejlsberg- Introducing-TypeScript • https://github.com/borisyankov/DefinitelyTyped • http://code.google.com/p/flexspaces/ • http://code.google.com/p/cmisspaces/ • www.integratedsemantics.org blog • www.integratedsemantics.com • Twitter: @stevereiner