In this talk I demonstrated how easy Dojo is integrating into the Adobe AIR runtime. Using a performance analysis tool I demonstrated how to use charting, grids and other features of Adobe AIR and the Dojo Toolkit
Report
Share
Report
Share
1 of 27
More Related Content
Dojo and Adobe AIR
1. Dojo and Adobe AIR Nikolai Onken, CEO uxebu Ltd. nikolai@uxebu.com - http://twitter.com/nonken
2. Me Nikolai Onken uxebu Ltd. Dojo community evangelist, committer DojoCampus.org Do you know this? Browser fights Sleeples nights Endless cursing about IE6 Wrestling with the floats Welcome
3. Adobe AIR Introduction Benefits Dojo Toolkit Introduction Benefits Hands on xRay, from web to AIR What are we going to do today?
4. The ideal world Existing Application Define functionality for AIR Deliver
5. The real world Existing Application Rewrite, disassemble, cleanup Test, bugfix Deliver? Define functionality for AIR
6. Is there a solution? Dojo Toolkit Module based Ready for AIR Feature rich Deliver Fast Adobe AIR
7. Features Webkit Offline apps SQL Lite Flash, e.g. sockets, etc. DND Access to filesystem Adobe AIR AIR Runtime
8. The core Client-side developers toolbox Helper functions OO The UI library Layout Forms Widgets Dojos Las Vegas (c) Tom Trenka Charting Grid Cometd The Dojo Toolkit Dojo Dijit Dojox
9. What do we have? Performance reports online Data API Charting API What do we want? Performance reports live and offline Interactivity Saveable sessions Screenshots, multimedia features Hands on - the analysis
10. Adobe AIR Sockets File storage SQL Lite DND Autoupdate Screenshots Dojo dojo.declare dojo.publish/subscribe dojox.grid dojox.charting dijit.layout i18n themeing Hands on - ingredients
12. Connecting to sockets this.socket = new air.Socket("localhost", 56789); // add listeners for success and failurethis.eventConnect = this.socket.addEventListener(air.Event.CONNECT, dojo.hitch(this, "connected"));this.eventIO = this.socket.addEventListener(air.IOErrorEvent.IO_ERROR, dojo.hitch(this, "disconnect")); connected: function(){ // on socket connection, connect to data event and handle data this.eventData = this.socket.addEventListener(air.ProgressEvent.SOCKET_DATA, dojo.hitch(this, "handleData")); } } Sockets (Socket.js)
13. Accessing local files this.docsDir = air.File.desktopDirectory.resolvePath("xRay session.xry");this.docsDir.browseForSave(this.messages.saveAs); this.docsDir.addEventListener(air.Event.SELECT, dojo.hitch(this, "_writeData", formData)); writeData: function(formData, e){ // on select we write data this.docsDir.removeEventListener(air.Event.SELECT, dojo.hitch(this, "_writeData", formData));// create new file objectvar file = air.File(e.target); // save to streamvar stream = new air.FileStream();stream.open( file, air.FileMode.WRITE );stream.writeMultiByte( dojo.toJson(this._createData(formData)), air.File.systemCharset );stream.close(); } File storage (DataStore.js - 165)
14. Working with SQLLite // connect to SQLLitethis.conn = new air.SQLConnection(); // event handlingthis.conn.addEventListener(air.SQLEvent.OPEN, function(e){d.callback(e);}); this.conn.addEventListener(air.SQLErrorEvent.ERROR, function(e){d.errback(e);}); // reference to db file, if not available it will be created automaticallyvar dbFile = air.File.applicationStorageDirectory.resolvePath(this.sqlLiteDb); this.conn.openAsync(dbFile); this.conn.addEventListener(air.SQLErrorEvent.ERROR, function(e){d.errback(e);}); // reference to db file, if not available it will be created automaticallyvar dbFile = air.File.applicationStorageDirectory.resolvePath(this.sqlLiteDb); this.conn.openAsync(dbFile); this.conn.addEventListener(air.SQLErrorEvent.ERROR, function(e){d.errback(e);}); // reference to db file, if not available it will be created automaticallyvar dbFile = air.File.applicationStorageDirectory.resolvePath(this.sqlLiteDb); this.conn.openAsync(dbFile); this.conn.addEventListener(air.SQLErrorEvent.ERROR, function(e){d.errback(e);}); // reference to db file, if not available it will be created automaticallyvar dbFile = air.File.applicationStorageDirectory.resolvePath(this.sqlLiteDb); this.conn.openAsync(dbFile); this.conn.addEventListener(air.SQLErrorEvent.ERROR, function(e){d.errback(e);}); // reference to db file, if not available it will be created automaticallyvar dbFile = air.File.applicationStorageDirectory.resolvePath(this.sqlLiteDb); this.conn.openAsync(dbFile); SQL Lite (DataStore.js - 97)
16. Keeping your application up to date this.updReq = new air.URLRequest(this.updateUrl);this.updStream = new air.URLStream();this.updData = new air.ByteArray(); this.updStream.addEventListener(air.Event.COMPLETE, dojo.hitch(this, function(){this.updStream.readBytes(this.updData, 0, this.updStream.bytesAvailable); var data = dojo.fromJson(this.updData);})); this.updStream.load(this.updReq); // run the update var updater = new air.Updater();var version = this.updateVersion;updater.update(this.file, this.updateVersion); var updater = new air.Updater();var version = this.updateVersion;updater.update(this.file, this.updateVersion); var updater = new air.Updater();var version = this.updateVersion;updater.update(this.file, this.updateVersion); var updater = new air.Updater();var version = this.updateVersion;updater.update(this.file, this.updateVersion); var updater = new air.Updater();var version = this.updateVersion;updater.update(this.file, this.updateVersion); Autoupdate