SlideShare une entreprise Scribd logo
1  sur  86
Télécharger pour lire hors ligne
Kranium	
  
Webifying	
  Titanium	
  Development	
  

              Jacob	
  Waller	
  
+!   +!   +!   →!
+
http://flic.kr/p/9wLZkJ!




               Kranium
•    Webifying Titanium Development!
"    Cross platform apps using javascript!

"    Shared business logic!

"    Native UI!

"    Device API:s!
Why cross-platform?


"    One codebase!

     "    Faster development → cheaper development!

     "    Less code → less bugs!

     "    Focus on one language and one tool!
Why not cross-platform?


"    Potential bugs in cross-platform frameworks!

"    Somewhat harder stepping outside the box!

"    Might still need platform branching!

"    Less speed and more memory usage!
Cross Platform is Hard


 "    iOS!                "    Android!

      "    Objective-C!   "    Java!

      "    XCode!         "    Eclipse!
Titanium takes the hit




              http://flic.kr/p/91Zydu!
Cross Platform Medicine


                          http://flic.kr/p/8dZbk4!




"    Must use lowest common denominator!

"    Go with a low-level API!

"    Must focus on getting the “atoms” behave
     the same across platforms!
Low-level




                  http://flic.kr/p/75b2DJ!




Means powerful!
Low-level




                    http://flic.kr/p/5JDvZM!




Also means annoying to build large stuff!
Low-level




                   http://flic.kr/p/nyxCW!




Is it therefore wrong?!
NO
High-level


"    Low level building blocks let us build high-
     level abstractions!

"    Upon which we can build awesome stuff!
High-level




         http://flic.kr/p/8ovJYH!
Titanium

"    Titanium Mobile has a low-level
     core API:s for each platform it
     supports!

"    Lets cover it in platform-
     independent high-level
     awesome-sauce!
But how?




    http://flic.kr/p/9wfuUh!
Parallel



"    Web development has low-level API:s!

     "    document.createElement!

     "    element.style.backgroundColor!
Web development

if (el.addEventListener) {	
    el.addEventListener("mouseover", myFunction, false);	
    el.addEventListener("mouseout", myFunction, false);	
} else if (el.attachEvent) {	
    el.attachEvent("onmouseover", myFunction);	
    el.attachEvent("onmouseout", myFunction);	
} else {	
    el.onmouseover = myFunction;	
    el.onmouseout = myFunction;	
}	




 Used to be painful, slow and ugly!
Web development
 $(el).bind("mouseover mouseout", myFunction);	




Is now pleasant, quick and sexy!
Ecosystem
Titanium development
var tabGroup = Ti.UI.createTabGroup(),	          shadowColor: '#fff',	
                                                 shadowOffset: { 	
    win1 = Ti.UI.createWindow({	                     y: -1, 	
         backgroundColor: '#ccc',	                   x: 0	
         barColor: '#00a',	                      },	
         title: 'My window'	                     font: {	
    }),	                                             fontSize: 20,	
                                                     fontWeight: 'bold'	
    tab1 = Ti.UI.createTab({	                    }	
         icon: 'path/to/my/icon',	        });	
         title: 'My tab',	
         window: win1	                win1.add(label1);	
    }),	                              label1.addEventListener('click', function(e){	
                                           alert('You clicked me!');	
    label1 = Ti.UI.createLabel({	     });	
        text: 'Hello world!',	
        textAlign: 'center',	         tabGroup.addTab(tab1);	
        color: '#333',	               tabGroup.open();	




   Used to be somewhat painful, slow and ugly!
Welcome Kranium




        http://flic.kr/p/9wLZkJ!
Titanium development

      K({	
          type: 'tabgroup',	
          tabs: [{	
              cls: 'myTab',	
              window: {	
                  cls: 'myWindow',	
                  children: [{	
                      text: 'Hello world!',	
                      cls: 'mylabel',	
                      click: function(){	
                          alert('You clicked me!');	
                      }	
                  }]	
              }	
          }]	
      }).open();	




 Is now more pleasant, quick and sexy!
Titanium development

          .myTab { 	
              icon: path/to/my/icon; 	
          }	
          window {	
              background-color: #ccc;	
              bar-color: #00a;	
          }	
          .myLabel {	
              text-align: center;	
              color: #333;	
              shadow-color: #fff;	
              shadow-offset-y: -1;	
              font-size: 20;	
              font-weight: bold;	
          }	




 Is now more pleasant, quick and sexy!
Titanium development
                                     Stylus


K(	                              .myTab	
  type: "tabgroup"	                  icon path/to/my/icon	
  tabs: [ 	
     className: "myTab"	         window	
     window: 	                       background-color #ccc	
       className: "myWindow"	        bar-color #00a	
       children: [ 	
         text: "Hello world!"	   .myLabel	
         className: "mylabel"	       text-align center	
        ]	                           color #333	
    ]	                               shadow-color #fff	
).open()	                            shadow-offset-y -1	
                                     font-size 20	
                                     font-weight bold	




              With lots of possibilities!
Kranium
"    Lovechild of the following stunning web frameworks:!
     "    jQuery / Zepto!
     "    Backbone!
     "    Jade!
     "    Livetanium / Livereload!
     "    Sizzle / mini.js!
     "    Jasmine!                                    http://bit.ly/3vVcI!




     "    JSS / Stylus / Sass / LESS!
     "    JSConsole / Weinre!
Comparison
jQuery / Zepto

"    Easy access selector engine!


     $('.content > .label, .hello').text('hello!');	
     $(el).find('.content');	
     $('.content', el);
jQuery / Zepto
"    Chainable collections with helper functions!



     $(el)	
         .text('hey')	
         .css({ color: '#f00' })	
         .parent('.row')	
             .bind('click', onClick)	
             .append(stuff);
jQuery / Zepto
"    Simplified API:s!


     $.ajax({	
          type: 'GET',	
          url: 'http://some/url',	
          success: function(data, status, xhr){	
              alert(data);	
          }	
     });
Titanium


"    Let’s see how these look in the low-level
     Titanium API!
Titanium

"    Easy access selector engine?!

     N/A
Titanium
"    Chainable collections with helper functions?!




     el.text = 'hey';	
     el.color = '#f00';	
     var parent = el.getParent().getParent().children().filter
     (function(el){	
          return /(^|s+)row(s+|$)/.test(el.className);	
     });	
     parent.addEventListener('click', onClick);	
     stuff.forEach(function(toAdd){	
          el.add(toAdd);	
     });
Titanium
"    Simplified API:s?!



     var xhr = Ti.Network.createHTTPClient();	
     xhr.open('GET', 'http://some/url');	
     xhr.onload = function(data, status, xhr){	
          alert(data);	
     });	
     xhr.send();
Kranium


"    Lets look at the same functionality using
     Kranium!
Kranium

"    Easy access selector engine!


     $('.content > .label, .hello').text('hello!');	
     $(el).find('.content');	
     $('.content', el);
Kranium
"    Chainable collections with helper functions!



     $(el)	
         .text('hey')	
         .css({ color: '#f00' })	
         .parent('.row')	
             .bind('click', onClick)	
             .append(stuff);
Kranium
"    Simplified API:s!


     $.ajax({	
          type: 'GET',	
          url: 'http://some/url',	
          success: function(data, status, xhr){	
              alert(data);	
          }	
     });
Kranium



                                 http://bit.ly/bW1zP5!




"    Tries to invent as few wheels as possible!

"    Instead piggyback on the ideas and momentum of
     existing great web frameworks!
What to piggyback?
                               "    jQuery / Zepto!
                               "    Backbone!
                               "    Jade!
                               "    Livetanium / Livereload!
                               "    Sizzle / mini.js!
                               "    Jasmine!
                               "    JSS / Stylus / Sass / LESS!

     http://flic.kr/p/7dpmyF!
                               "    JSConsole / Weinre!
What IS Kranium?


"    A utility library to include in your app!
"    A command line program!
Utility library
"    Exposes a jQuery-like object called K (or $)!
"    Exposes Backbone integration!
"    Exposes Jade template engine!
"    Implements simple selector engine!
"    Implements enhanced styling!
"    Implements extendable modules!
Command line program

 "    Built on NodeJS and NPM!
 "    Initiates Kranium resources in project!
 "    Pipes live updates!
 "    Two-way console!
 "    Jasmine reporter!
Template engine
A great template engine is a huge
help in keeping your code:!


"    DRY!

"    separated!

"    consise!
Jade
"    Lightweight!

"    Supports custom compilers!

"    Compiles templates to functions!

"    Beautiful syntax!

"    Consise!

"    In active development!
Jade example
// test.jade	
view.board	
  label.boardTitle Board	
  view.boardMessages	
    - each msg, user in users	
      label.boardMessage= user + ' says ' + msg
K.jade('test.jade', { 	
     users: { 	
         jacob: 'yeah',	
         david: 'what',	
         conny: 'hi', 	
         aida: 'hello',	
         calle: 'yup'	
     }	
});
.board {	
    top: 10;	
    left: 10;	
}	
.boardMessages {	
    top: 30;	
    layout: vertical;	
}	
.boardMessage {	
    height: 20;	
    top: 10;	
}	
.boardTitle {	
    top: 0;	
    height: auto;	
    font-weight: bold;	
}
JSS

"    Great feature in theory - gives Separation of
     Concerns!

"    Hasn’t always been working well !

"    Not powerful and extendable enough!
KSS
"    A styling layer implemented in the javascript
     context!

"    Everything created using K function is styled
     appropriately!

"    Style based on Types, Classes and IDs!

"    Platform branching using psuedo selectors!

"    Variable evaluation!
KSS
label {	
    color: #000;	
    font-size: 16dp;	
}	
label:android {	
    font-size: 17dp;	
    text-align: left;	
}	
tableview:ios {	
    style: Ti.UI.iPhone.TableViewStyle.GROUPED;	
}
KUI


                              http://flic.kr/p/6a3wzw!




"    Extendable UI Modules!

"    Simple Inheritance!

"    Automatic KSS loading!
Example
kui/loginstatus.js!


   exports.Class = Label.extend({	
       className: "loginstatus",	
       init: function(opts) {	
           this.events = {	
               app: {	
                   authchange: this.updateStatus.bind(this)	
               }	
           };	
                this._super.call(this, opts);	
                this.updateStatus();	
          },	
          updateStatus: function(e) {	
              this.el.text = "Logged " + (e && e.loggedIn ? "in" : "out");	
          }	
   });
Example
kui/loginstatus.kss!




   .loginstatus {	
       color: #f00;	
   }
Example
app.js!



   K({	
       type: 'window',	
       children: [{	
           type: 'loggedinstatus'	
       }]	
   }).open();	
   var i = 0;	
   setInterval(function(){	
       Ti.App.fireEvent('authchange', {	
            loggedIn: !!(++i % 2)	
       });	
   }, 1000);
Example
app.js!


   K({	
       type: 'window',	
       children: [{	
           top: 10,	
           type: 'loggedinstatus'	
       },	
       {	
           bottom: 10,	
           type: 'loggedinstatus'	
       }]	
   }).open();	
   var i = 0;	
   setInterval(function(){	
       Ti.App.fireEvent('authchange', {	
            loggedIn: !!(++i % 2)	
       });	
   }, 1000);
Backbone supplies structure to JavaScript-heavy
applications by providing models with key-value
binding and custom events, collections with a rich
API of enumerable functions and views with
declarative event handling...
Code walkthrough
// Define model	
RowModel = Backbone.Model.extend({	
     type: 'tableviewrow'	
});	
// Define collection	
RowCollection = Backbone.Collection.extend({	
     model: RowModel,    	
     comparator: function(model) {	
         return model.get("title");	
     }	
});	
// Create todos collection	
todos = new RowCollection();	
todos.add([	
     { title: "An example todo" },	
     { title: "Another example todo" },	
]);	
// Create todolist	
var todolist = K.create({	
     type: 'todolist',	
     collection: todos	
});
// kui/todolist.js	
exports.Class = BackboneView.extend({	
    type: 'tableview',	
    editable: true, 	
       events: {	
           click: function(e){	
               var model = todos.getByCid(e.rowData._modelCid);	
               model.set({ hasCheck: !model.get('hasCheck') });	
           },	
           "delete": function(e){	
               var model = todos.getByCid(e.rowData._modelCid);	
               todos.remove(model);	
           }	
       }	
});
exports.Class = Window.extend({	
    navBarHidden: true,	
    init: function(o){	

             this.titleLabel = K.createLabel({	
                  className: 'titleLabel'	
             });	
             todos.bind('all', this.updateTitleLabel.bind(this));	
             this.updateTitleLabel();	

             this.children = [{	
                     type: 'toolbar',	
                     className: 'todoToolbar',	
                     items: [{	
                         type: 'textfield',	
                         className: 'todoInputTextField',	
                         events: {	
                             "return": function(e){	
                                 todos.add({ title: e.value });	
                             }	
                         }	
                     },	
                     'spacer',	
                     this.titleLabel]	
                 }, todolist];	
             this._super(o);	
       },	

       updateTitleLabel: function(){	
           var completed = todos.filter(function(m){ return m.get('hasCheck') }).length;	
           this.titleLabel.text = completed + ' / ' + todos.length + ' todos';	
       }	
});
Polyfill missing UI
"    Android lacks many simple UI modules!

     "    Navbar!

     "    TabbedBar!

     "    ButtonBar!

     "    Toolbar!

     "    Extendable TabBar"


"    Kranium implements these!
Polyfill missing UI
Polyfill missing UI
Extend Base UI

    K.createTableview({	
        pullToRefresh: true,	
        refresh: function(){	
            K.ajax({	
                 url: 'http://example.com/service.json',	
                 success: this.render	
            });	
        },	
           render: function(data){	
               this.setData(data.rows.map(this.createRow));	
           },	
           createRow: function(o){	
               return K.createTableViewRow({	
                    title: o.name	
               });	
           }	
    });
Livetanium


"    Kranium integrates Livetanium!

"    Gives you live updates of KSS style changes as
     well as module updates!
Jasmine
describe('Demo', function() {	
    describe('Titanium Object', function(){	
        it('Ti == Titanium', function(){ expect(Titanium).toEqual(Ti); });	
        it('Ti.App', function(){ expect(Titanium).toBeDefined(); });	
    }); 	
       describe('TabGroup', function(){	
            it('Has tabgroup', function(){ 	
                 expect(K('tabgroup').length).toBeGreaterThan(0); 	
            });	
            it('TabGroup.activeTab.title === "test"', function(){ 	
                 expect(K('tabgroup').get(0).activeTab.title).toEqual("test"); 	
            });	
       });	
});
Console
Summary
"    Consists of a command line program and an
     includable library!

"    Ports the best web development libraries and
     technologies to Titanium!

"    Polyfills parts missing between platforms!

"    Helps you with your KISS:ing and keeps you
     DRY!
Available now
"    Currently in open beta!

     "    Source under MIT License!

     "    Hosted on GitHub!

     "    Pull requests and co-maintainers welcome"


"    http://github.com/krawaller/kranium!
Available now


"    Beware!

     "    There will be bugs!

     "    API far from frozen!
Available now

"    Works best with iOS, but Android getting
     there!

"    CLI works best on Mac OSX!

     "    Will be tested and fixed for Linux and
          Windows !
http://kraniumjs.com
Installation


"    1. Install NodeJS and NPM!

"    2. Run `npm install kranium`!

"    3. There is no step 3!
Questions?




  http://flic.kr/p/7vB7fR!
Thank you

                   +

       @litenjacob!
   jacob@krawaller.se!
jacob.waller@logica.com!
Go contribute please!




           http://flic.kr/p/9C7DZZ!

Contenu connexe

Tendances

Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
Jeado Ko
 
JavaScript Advanced - Useful methods to power up your code
JavaScript Advanced - Useful methods to power up your codeJavaScript Advanced - Useful methods to power up your code
JavaScript Advanced - Useful methods to power up your code
Laurence Svekis ✔
 
JavaScript For People Who Don't Code
JavaScript For People Who Don't CodeJavaScript For People Who Don't Code
JavaScript For People Who Don't Code
Christopher Schmitt
 
Bcblackpool jquery tips
Bcblackpool jquery tipsBcblackpool jquery tips
Bcblackpool jquery tips
Jack Franklin
 

Tendances (20)

jQuery Features to Avoid
jQuery Features to AvoidjQuery Features to Avoid
jQuery Features to Avoid
 
jQuery (DrupalCamp Toronto)
jQuery (DrupalCamp Toronto)jQuery (DrupalCamp Toronto)
jQuery (DrupalCamp Toronto)
 
jQuery (MeshU)
jQuery (MeshU)jQuery (MeshU)
jQuery (MeshU)
 
jQuery('#knowledge').appendTo('#you');
jQuery('#knowledge').appendTo('#you');jQuery('#knowledge').appendTo('#you');
jQuery('#knowledge').appendTo('#you');
 
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
 
JavaScript Advanced - Useful methods to power up your code
JavaScript Advanced - Useful methods to power up your codeJavaScript Advanced - Useful methods to power up your code
JavaScript Advanced - Useful methods to power up your code
 
jQuery: Nuts, Bolts and Bling
jQuery: Nuts, Bolts and BlingjQuery: Nuts, Bolts and Bling
jQuery: Nuts, Bolts and Bling
 
The jQuery Library
The  jQuery LibraryThe  jQuery Library
The jQuery Library
 
Bootstrap과 UI-Bootstrap
Bootstrap과 UI-BootstrapBootstrap과 UI-Bootstrap
Bootstrap과 UI-Bootstrap
 
WordPress and Ajax
WordPress and AjaxWordPress and Ajax
WordPress and Ajax
 
DrupalCon jQuery
DrupalCon jQueryDrupalCon jQuery
DrupalCon jQuery
 
Write Less Do More
Write Less Do MoreWrite Less Do More
Write Less Do More
 
HTML 5 - Overview
HTML 5 - OverviewHTML 5 - Overview
HTML 5 - Overview
 
APIdays Zurich 2019 - Specification Driven Development for REST APIS Alexande...
APIdays Zurich 2019 - Specification Driven Development for REST APIS Alexande...APIdays Zurich 2019 - Specification Driven Development for REST APIS Alexande...
APIdays Zurich 2019 - Specification Driven Development for REST APIS Alexande...
 
Maintainable JavaScript 2012
Maintainable JavaScript 2012Maintainable JavaScript 2012
Maintainable JavaScript 2012
 
JavaScript For People Who Don't Code
JavaScript For People Who Don't CodeJavaScript For People Who Don't Code
JavaScript For People Who Don't Code
 
HTML5: friend or foe (to Flash)?
HTML5: friend or foe (to Flash)?HTML5: friend or foe (to Flash)?
HTML5: friend or foe (to Flash)?
 
HTML5: where flash isn't needed anymore
HTML5: where flash isn't needed anymoreHTML5: where flash isn't needed anymore
HTML5: where flash isn't needed anymore
 
Bcblackpool jquery tips
Bcblackpool jquery tipsBcblackpool jquery tips
Bcblackpool jquery tips
 
Building iPad apps with Flex - 360Flex
Building iPad apps with Flex - 360FlexBuilding iPad apps with Flex - 360Flex
Building iPad apps with Flex - 360Flex
 

En vedette

Codestrong 2012 breakout session android internals and best practices
Codestrong 2012 breakout session   android internals and best practicesCodestrong 2012 breakout session   android internals and best practices
Codestrong 2012 breakout session android internals and best practices
Axway Appcelerator
 
Codestrong 2012 breakout session leveraging titanium as part of your mobile...
Codestrong 2012 breakout session   leveraging titanium as part of your mobile...Codestrong 2012 breakout session   leveraging titanium as part of your mobile...
Codestrong 2012 breakout session leveraging titanium as part of your mobile...
Axway Appcelerator
 
iPhone/iPad Development with Titanium
iPhone/iPad Development with TitaniumiPhone/iPad Development with Titanium
iPhone/iPad Development with Titanium
Axway Appcelerator
 
Codestrong 2012 breakout session how to win bigger mobile deals
Codestrong 2012 breakout session   how to win bigger mobile dealsCodestrong 2012 breakout session   how to win bigger mobile deals
Codestrong 2012 breakout session how to win bigger mobile deals
Axway Appcelerator
 
Codestrong 2012 breakout session exploring the new titanium command line in...
Codestrong 2012 breakout session   exploring the new titanium command line in...Codestrong 2012 breakout session   exploring the new titanium command line in...
Codestrong 2012 breakout session exploring the new titanium command line in...
Axway Appcelerator
 
Desktop Applications Using HTML & JavaScript (and Python & Ruby
Desktop Applications Using HTML & JavaScript (and Python & RubyDesktop Applications Using HTML & JavaScript (and Python & Ruby
Desktop Applications Using HTML & JavaScript (and Python & Ruby
Axway Appcelerator
 
Nouran El Kiki - Sept 2016
Nouran El Kiki - Sept 2016Nouran El Kiki - Sept 2016
Nouran El Kiki - Sept 2016
Nouran Adel
 

En vedette (20)

5 Secrets to Successfully Publishing in Appcelerator's Marketplace
5 Secrets to Successfully Publishing in Appcelerator's Marketplace5 Secrets to Successfully Publishing in Appcelerator's Marketplace
5 Secrets to Successfully Publishing in Appcelerator's Marketplace
 
Appcelerator Acquires Aptana
Appcelerator Acquires Aptana Appcelerator Acquires Aptana
Appcelerator Acquires Aptana
 
Codestrong 2012 breakout session android internals and best practices
Codestrong 2012 breakout session   android internals and best practicesCodestrong 2012 breakout session   android internals and best practices
Codestrong 2012 breakout session android internals and best practices
 
Codestrong 2012 breakout session leveraging titanium as part of your mobile...
Codestrong 2012 breakout session   leveraging titanium as part of your mobile...Codestrong 2012 breakout session   leveraging titanium as part of your mobile...
Codestrong 2012 breakout session leveraging titanium as part of your mobile...
 
Ajax World 2008
Ajax World 2008Ajax World 2008
Ajax World 2008
 
Ted Patrick: Developing Apps for the Barnes & Noble NOOK
Ted Patrick: Developing Apps for the Barnes & Noble NOOKTed Patrick: Developing Apps for the Barnes & Noble NOOK
Ted Patrick: Developing Apps for the Barnes & Noble NOOK
 
Fred Spencer: Designing a Great UI
Fred Spencer: Designing a Great UIFred Spencer: Designing a Great UI
Fred Spencer: Designing a Great UI
 
iPhone/iPad Development with Titanium
iPhone/iPad Development with TitaniumiPhone/iPad Development with Titanium
iPhone/iPad Development with Titanium
 
Appcelerator’s Cocoafish Acquisition and the Future of the Mobile Cloud
Appcelerator’s Cocoafish Acquisition and the  Future of the Mobile Cloud Appcelerator’s Cocoafish Acquisition and the  Future of the Mobile Cloud
Appcelerator’s Cocoafish Acquisition and the Future of the Mobile Cloud
 
Advanced titanium for i os
Advanced titanium for i osAdvanced titanium for i os
Advanced titanium for i os
 
Codestrong 2012 breakout session how to win bigger mobile deals
Codestrong 2012 breakout session   how to win bigger mobile dealsCodestrong 2012 breakout session   how to win bigger mobile deals
Codestrong 2012 breakout session how to win bigger mobile deals
 
Kevin Whinnery: Best Practices for Cross-Platform Mobile Development
Kevin Whinnery: Best Practices for Cross-Platform Mobile DevelopmentKevin Whinnery: Best Practices for Cross-Platform Mobile Development
Kevin Whinnery: Best Practices for Cross-Platform Mobile Development
 
Codestrong 2012 breakout session exploring the new titanium command line in...
Codestrong 2012 breakout session   exploring the new titanium command line in...Codestrong 2012 breakout session   exploring the new titanium command line in...
Codestrong 2012 breakout session exploring the new titanium command line in...
 
Desktop Applications Using HTML & JavaScript (and Python & Ruby
Desktop Applications Using HTML & JavaScript (and Python & RubyDesktop Applications Using HTML & JavaScript (and Python & Ruby
Desktop Applications Using HTML & JavaScript (and Python & Ruby
 
Mobile for the rest of us
Mobile for the rest of usMobile for the rest of us
Mobile for the rest of us
 
Rick Blalock: Your Apps are Leaking - Controlling Memory Leaks
Rick Blalock: Your Apps are Leaking - Controlling Memory LeaksRick Blalock: Your Apps are Leaking - Controlling Memory Leaks
Rick Blalock: Your Apps are Leaking - Controlling Memory Leaks
 
Mobile & The New Experience Economy (And What it Means for IT)
Mobile & The New Experience Economy  (And What it Means for IT)Mobile & The New Experience Economy  (And What it Means for IT)
Mobile & The New Experience Economy (And What it Means for IT)
 
Gőgös Gúnár Gedeon
Gőgös Gúnár GedeonGőgös Gúnár Gedeon
Gőgös Gúnár Gedeon
 
Nouran El Kiki - Sept 2016
Nouran El Kiki - Sept 2016Nouran El Kiki - Sept 2016
Nouran El Kiki - Sept 2016
 
Arabella Booklet
Arabella BookletArabella Booklet
Arabella Booklet
 

Similaire à Jacob Waller: Webifying Titanium Development

JavaScript Libraries: The Big Picture
JavaScript Libraries: The Big PictureJavaScript Libraries: The Big Picture
JavaScript Libraries: The Big Picture
Simon Willison
 
Jarv.us Showcase — SenchaCon 2011
Jarv.us Showcase — SenchaCon 2011Jarv.us Showcase — SenchaCon 2011
Jarv.us Showcase — SenchaCon 2011
Chris Alfano
 
Titanium Introduction
Titanium IntroductionTitanium Introduction
Titanium Introduction
chortlehoort
 

Similaire à Jacob Waller: Webifying Titanium Development (20)

The Inclusive Web: hands-on with HTML5 and jQuery
The Inclusive Web: hands-on with HTML5 and jQueryThe Inclusive Web: hands-on with HTML5 and jQuery
The Inclusive Web: hands-on with HTML5 and jQuery
 
JavaScript Libraries: The Big Picture
JavaScript Libraries: The Big PictureJavaScript Libraries: The Big Picture
JavaScript Libraries: The Big Picture
 
Jarv.us Showcase — SenchaCon 2011
Jarv.us Showcase — SenchaCon 2011Jarv.us Showcase — SenchaCon 2011
Jarv.us Showcase — SenchaCon 2011
 
Functional testing with capybara
Functional testing with capybaraFunctional testing with capybara
Functional testing with capybara
 
Ext JS Introduction
Ext JS IntroductionExt JS Introduction
Ext JS Introduction
 
Web Frontend development: tools and good practices to (re)organize the chaos
Web Frontend development: tools and good practices to (re)organize the chaosWeb Frontend development: tools and good practices to (re)organize the chaos
Web Frontend development: tools and good practices to (re)organize the chaos
 
About Clack
About ClackAbout Clack
About Clack
 
Jquery fundamentals
Jquery fundamentalsJquery fundamentals
Jquery fundamentals
 
How to make Ajax Libraries work for you
How to make Ajax Libraries work for youHow to make Ajax Libraries work for you
How to make Ajax Libraries work for you
 
Titanium Introduction
Titanium IntroductionTitanium Introduction
Titanium Introduction
 
Titanium Introduction
Titanium IntroductionTitanium Introduction
Titanium Introduction
 
Event-driven IO server-side JavaScript environment based on V8 Engine
Event-driven IO server-side JavaScript environment based on V8 EngineEvent-driven IO server-side JavaScript environment based on V8 Engine
Event-driven IO server-side JavaScript environment based on V8 Engine
 
Web Development for UX Designers
Web Development for UX DesignersWeb Development for UX Designers
Web Development for UX Designers
 
FrontInBahia 2014: 10 dicas de desempenho para apps mobile híbridas
FrontInBahia 2014: 10 dicas de desempenho para apps mobile híbridasFrontInBahia 2014: 10 dicas de desempenho para apps mobile híbridas
FrontInBahia 2014: 10 dicas de desempenho para apps mobile híbridas
 
Lekhoniya Documentation.pdf
Lekhoniya Documentation.pdfLekhoniya Documentation.pdf
Lekhoniya Documentation.pdf
 
soft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.jssoft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.js
 
From Hacker to Programmer (w/ Webpack, Babel and React)
From Hacker to Programmer (w/ Webpack, Babel and React)From Hacker to Programmer (w/ Webpack, Babel and React)
From Hacker to Programmer (w/ Webpack, Babel and React)
 
JavaScript!
JavaScript!JavaScript!
JavaScript!
 
Xitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディング
Xitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディングXitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディング
Xitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディング
 
Xitrum @ Scala Matsuri Tokyo 2014
Xitrum @ Scala Matsuri Tokyo 2014Xitrum @ Scala Matsuri Tokyo 2014
Xitrum @ Scala Matsuri Tokyo 2014
 

Plus de Axway Appcelerator

Codestrong 2012 keynote jonathan rende, appcelerator's vp of products
Codestrong 2012 keynote   jonathan rende, appcelerator's vp of productsCodestrong 2012 keynote   jonathan rende, appcelerator's vp of products
Codestrong 2012 keynote jonathan rende, appcelerator's vp of products
Axway Appcelerator
 
Codestrong 2012 keynote jeff haynie, appcelerator's ceo
Codestrong 2012 keynote   jeff haynie, appcelerator's ceoCodestrong 2012 keynote   jeff haynie, appcelerator's ceo
Codestrong 2012 keynote jeff haynie, appcelerator's ceo
Axway Appcelerator
 
Codestrong 2012 keynote how to build a top ten app
Codestrong 2012 keynote   how to build a top ten appCodestrong 2012 keynote   how to build a top ten app
Codestrong 2012 keynote how to build a top ten app
Axway Appcelerator
 
Codestrong 2012 breakout session at&t api platform and trends
Codestrong 2012 breakout session  at&t api platform and trendsCodestrong 2012 breakout session  at&t api platform and trends
Codestrong 2012 breakout session at&t api platform and trends
Axway Appcelerator
 
Codestrong 2012 breakout session what's new in titanium studio
Codestrong 2012 breakout session   what's new in titanium studioCodestrong 2012 breakout session   what's new in titanium studio
Codestrong 2012 breakout session what's new in titanium studio
Axway Appcelerator
 
Codestrong 2012 breakout session using appcelerator cloud services in your ...
Codestrong 2012 breakout session   using appcelerator cloud services in your ...Codestrong 2012 breakout session   using appcelerator cloud services in your ...
Codestrong 2012 breakout session using appcelerator cloud services in your ...
Axway Appcelerator
 
Codestrong 2012 breakout session the role of cloud services in your next ge...
Codestrong 2012 breakout session   the role of cloud services in your next ge...Codestrong 2012 breakout session   the role of cloud services in your next ge...
Codestrong 2012 breakout session the role of cloud services in your next ge...
Axway Appcelerator
 
Codestrong 2012 breakout session new device platform support for titanium
Codestrong 2012 breakout session   new device platform support for titaniumCodestrong 2012 breakout session   new device platform support for titanium
Codestrong 2012 breakout session new device platform support for titanium
Axway Appcelerator
 
Codestrong 2012 breakout session mobile platform and infrastructure
Codestrong 2012 breakout session   mobile platform and infrastructureCodestrong 2012 breakout session   mobile platform and infrastructure
Codestrong 2012 breakout session mobile platform and infrastructure
Axway Appcelerator
 
Codestrong 2012 breakout session making money on appcelerator's marketplace
Codestrong 2012 breakout session   making money on appcelerator's marketplaceCodestrong 2012 breakout session   making money on appcelerator's marketplace
Codestrong 2012 breakout session making money on appcelerator's marketplace
Axway Appcelerator
 
Codestrong 2012 breakout session live multi-platform testing
Codestrong 2012 breakout session   live multi-platform testingCodestrong 2012 breakout session   live multi-platform testing
Codestrong 2012 breakout session live multi-platform testing
Axway Appcelerator
 
Codestrong 2012 breakout session i os internals and best practices
Codestrong 2012 breakout session   i os internals and best practicesCodestrong 2012 breakout session   i os internals and best practices
Codestrong 2012 breakout session i os internals and best practices
Axway Appcelerator
 
Codestrong 2012 breakout session introduction to mobile web and best practices
Codestrong 2012 breakout session   introduction to mobile web and best practicesCodestrong 2012 breakout session   introduction to mobile web and best practices
Codestrong 2012 breakout session introduction to mobile web and best practices
Axway Appcelerator
 
Codestrong 2012 breakout session how to develop your own modules
Codestrong 2012 breakout session   how to develop your own modulesCodestrong 2012 breakout session   how to develop your own modules
Codestrong 2012 breakout session how to develop your own modules
Axway Appcelerator
 

Plus de Axway Appcelerator (20)

Axway Appcelerator - Titanium SDK 6.1.0 - Status, Releases & Roadmap
Axway Appcelerator - Titanium SDK 6.1.0 - Status, Releases & RoadmapAxway Appcelerator - Titanium SDK 6.1.0 - Status, Releases & Roadmap
Axway Appcelerator - Titanium SDK 6.1.0 - Status, Releases & Roadmap
 
2014 Dublin Web Summit by Jeff Haynie
2014 Dublin Web Summit by Jeff Haynie2014 Dublin Web Summit by Jeff Haynie
2014 Dublin Web Summit by Jeff Haynie
 
Making the Mobile Mind Shift
Making the Mobile Mind ShiftMaking the Mobile Mind Shift
Making the Mobile Mind Shift
 
Stop Debating, Start Measuring
Stop Debating, Start MeasuringStop Debating, Start Measuring
Stop Debating, Start Measuring
 
Apps, APIs & Analytics: What "Mobile First" Really Means
Apps, APIs & Analytics: What "Mobile First" Really MeansApps, APIs & Analytics: What "Mobile First" Really Means
Apps, APIs & Analytics: What "Mobile First" Really Means
 
Appcelerator Presentation Template
Appcelerator Presentation TemplateAppcelerator Presentation Template
Appcelerator Presentation Template
 
Codestrong 2012 keynote jonathan rende, appcelerator's vp of products
Codestrong 2012 keynote   jonathan rende, appcelerator's vp of productsCodestrong 2012 keynote   jonathan rende, appcelerator's vp of products
Codestrong 2012 keynote jonathan rende, appcelerator's vp of products
 
Codestrong 2012 keynote jeff haynie, appcelerator's ceo
Codestrong 2012 keynote   jeff haynie, appcelerator's ceoCodestrong 2012 keynote   jeff haynie, appcelerator's ceo
Codestrong 2012 keynote jeff haynie, appcelerator's ceo
 
Codestrong 2012 keynote how to build a top ten app
Codestrong 2012 keynote   how to build a top ten appCodestrong 2012 keynote   how to build a top ten app
Codestrong 2012 keynote how to build a top ten app
 
Codestrong 2012 breakout session at&t api platform and trends
Codestrong 2012 breakout session  at&t api platform and trendsCodestrong 2012 breakout session  at&t api platform and trends
Codestrong 2012 breakout session at&t api platform and trends
 
Codestrong 2012 breakout session what's new in titanium studio
Codestrong 2012 breakout session   what's new in titanium studioCodestrong 2012 breakout session   what's new in titanium studio
Codestrong 2012 breakout session what's new in titanium studio
 
Codestrong 2012 breakout session using appcelerator cloud services in your ...
Codestrong 2012 breakout session   using appcelerator cloud services in your ...Codestrong 2012 breakout session   using appcelerator cloud services in your ...
Codestrong 2012 breakout session using appcelerator cloud services in your ...
 
Codestrong 2012 breakout session the role of cloud services in your next ge...
Codestrong 2012 breakout session   the role of cloud services in your next ge...Codestrong 2012 breakout session   the role of cloud services in your next ge...
Codestrong 2012 breakout session the role of cloud services in your next ge...
 
Codestrong 2012 breakout session new device platform support for titanium
Codestrong 2012 breakout session   new device platform support for titaniumCodestrong 2012 breakout session   new device platform support for titanium
Codestrong 2012 breakout session new device platform support for titanium
 
Codestrong 2012 breakout session mobile platform and infrastructure
Codestrong 2012 breakout session   mobile platform and infrastructureCodestrong 2012 breakout session   mobile platform and infrastructure
Codestrong 2012 breakout session mobile platform and infrastructure
 
Codestrong 2012 breakout session making money on appcelerator's marketplace
Codestrong 2012 breakout session   making money on appcelerator's marketplaceCodestrong 2012 breakout session   making money on appcelerator's marketplace
Codestrong 2012 breakout session making money on appcelerator's marketplace
 
Codestrong 2012 breakout session live multi-platform testing
Codestrong 2012 breakout session   live multi-platform testingCodestrong 2012 breakout session   live multi-platform testing
Codestrong 2012 breakout session live multi-platform testing
 
Codestrong 2012 breakout session i os internals and best practices
Codestrong 2012 breakout session   i os internals and best practicesCodestrong 2012 breakout session   i os internals and best practices
Codestrong 2012 breakout session i os internals and best practices
 
Codestrong 2012 breakout session introduction to mobile web and best practices
Codestrong 2012 breakout session   introduction to mobile web and best practicesCodestrong 2012 breakout session   introduction to mobile web and best practices
Codestrong 2012 breakout session introduction to mobile web and best practices
 
Codestrong 2012 breakout session how to develop your own modules
Codestrong 2012 breakout session   how to develop your own modulesCodestrong 2012 breakout session   how to develop your own modules
Codestrong 2012 breakout session how to develop your own modules
 

Dernier

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Dernier (20)

2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 

Jacob Waller: Webifying Titanium Development

  • 1. Kranium   Webifying  Titanium  Development   Jacob  Waller  
  • 2.
  • 3. +! +! +! →!
  • 4. +
  • 5. http://flic.kr/p/9wLZkJ! Kranium •  Webifying Titanium Development!
  • 6. "  Cross platform apps using javascript! "  Shared business logic! "  Native UI! "  Device API:s!
  • 7. Why cross-platform? "  One codebase! "  Faster development → cheaper development! "  Less code → less bugs! "  Focus on one language and one tool!
  • 8. Why not cross-platform? "  Potential bugs in cross-platform frameworks! "  Somewhat harder stepping outside the box! "  Might still need platform branching! "  Less speed and more memory usage!
  • 9. Cross Platform is Hard "  iOS! "  Android! "  Objective-C! "  Java! "  XCode! "  Eclipse!
  • 10. Titanium takes the hit http://flic.kr/p/91Zydu!
  • 11. Cross Platform Medicine http://flic.kr/p/8dZbk4! "  Must use lowest common denominator! "  Go with a low-level API! "  Must focus on getting the “atoms” behave the same across platforms!
  • 12. Low-level http://flic.kr/p/75b2DJ! Means powerful!
  • 13. Low-level http://flic.kr/p/5JDvZM! Also means annoying to build large stuff!
  • 14. Low-level http://flic.kr/p/nyxCW! Is it therefore wrong?!
  • 15. NO
  • 16. High-level "  Low level building blocks let us build high- level abstractions! "  Upon which we can build awesome stuff!
  • 17. High-level http://flic.kr/p/8ovJYH!
  • 18. Titanium "  Titanium Mobile has a low-level core API:s for each platform it supports! "  Lets cover it in platform- independent high-level awesome-sauce!
  • 19. But how? http://flic.kr/p/9wfuUh!
  • 20. Parallel "  Web development has low-level API:s! "  document.createElement! "  element.style.backgroundColor!
  • 21. Web development if (el.addEventListener) { el.addEventListener("mouseover", myFunction, false); el.addEventListener("mouseout", myFunction, false); } else if (el.attachEvent) { el.attachEvent("onmouseover", myFunction); el.attachEvent("onmouseout", myFunction); } else { el.onmouseover = myFunction; el.onmouseout = myFunction; } Used to be painful, slow and ugly!
  • 22. Web development $(el).bind("mouseover mouseout", myFunction); Is now pleasant, quick and sexy!
  • 24. Titanium development var tabGroup = Ti.UI.createTabGroup(), shadowColor: '#fff', shadowOffset: { win1 = Ti.UI.createWindow({ y: -1, backgroundColor: '#ccc', x: 0 barColor: '#00a', }, title: 'My window' font: { }), fontSize: 20, fontWeight: 'bold' tab1 = Ti.UI.createTab({ } icon: 'path/to/my/icon', }); title: 'My tab', window: win1 win1.add(label1); }), label1.addEventListener('click', function(e){ alert('You clicked me!'); label1 = Ti.UI.createLabel({ }); text: 'Hello world!', textAlign: 'center', tabGroup.addTab(tab1); color: '#333', tabGroup.open(); Used to be somewhat painful, slow and ugly!
  • 25. Welcome Kranium http://flic.kr/p/9wLZkJ!
  • 26. Titanium development K({ type: 'tabgroup', tabs: [{ cls: 'myTab', window: { cls: 'myWindow', children: [{ text: 'Hello world!', cls: 'mylabel', click: function(){ alert('You clicked me!'); } }] } }] }).open(); Is now more pleasant, quick and sexy!
  • 27. Titanium development .myTab { icon: path/to/my/icon; } window { background-color: #ccc; bar-color: #00a; } .myLabel { text-align: center; color: #333; shadow-color: #fff; shadow-offset-y: -1; font-size: 20; font-weight: bold; } Is now more pleasant, quick and sexy!
  • 28. Titanium development Stylus K( .myTab type: "tabgroup" icon path/to/my/icon tabs: [ className: "myTab" window window: background-color #ccc className: "myWindow" bar-color #00a children: [ text: "Hello world!" .myLabel className: "mylabel" text-align center ] color #333 ] shadow-color #fff ).open() shadow-offset-y -1 font-size 20 font-weight bold With lots of possibilities!
  • 29. Kranium "  Lovechild of the following stunning web frameworks:! "  jQuery / Zepto! "  Backbone! "  Jade! "  Livetanium / Livereload! "  Sizzle / mini.js! "  Jasmine! http://bit.ly/3vVcI! "  JSS / Stylus / Sass / LESS! "  JSConsole / Weinre!
  • 31. jQuery / Zepto "  Easy access selector engine! $('.content > .label, .hello').text('hello!'); $(el).find('.content'); $('.content', el);
  • 32. jQuery / Zepto "  Chainable collections with helper functions! $(el) .text('hey') .css({ color: '#f00' }) .parent('.row') .bind('click', onClick) .append(stuff);
  • 33. jQuery / Zepto "  Simplified API:s! $.ajax({ type: 'GET', url: 'http://some/url', success: function(data, status, xhr){ alert(data); } });
  • 34. Titanium "  Let’s see how these look in the low-level Titanium API!
  • 35. Titanium "  Easy access selector engine?! N/A
  • 36. Titanium "  Chainable collections with helper functions?! el.text = 'hey'; el.color = '#f00'; var parent = el.getParent().getParent().children().filter (function(el){ return /(^|s+)row(s+|$)/.test(el.className); }); parent.addEventListener('click', onClick); stuff.forEach(function(toAdd){ el.add(toAdd); });
  • 37. Titanium "  Simplified API:s?! var xhr = Ti.Network.createHTTPClient(); xhr.open('GET', 'http://some/url'); xhr.onload = function(data, status, xhr){ alert(data); }); xhr.send();
  • 38. Kranium "  Lets look at the same functionality using Kranium!
  • 39. Kranium "  Easy access selector engine! $('.content > .label, .hello').text('hello!'); $(el).find('.content'); $('.content', el);
  • 40. Kranium "  Chainable collections with helper functions! $(el) .text('hey') .css({ color: '#f00' }) .parent('.row') .bind('click', onClick) .append(stuff);
  • 41. Kranium "  Simplified API:s! $.ajax({ type: 'GET', url: 'http://some/url', success: function(data, status, xhr){ alert(data); } });
  • 42. Kranium http://bit.ly/bW1zP5! "  Tries to invent as few wheels as possible! "  Instead piggyback on the ideas and momentum of existing great web frameworks!
  • 43. What to piggyback? "  jQuery / Zepto! "  Backbone! "  Jade! "  Livetanium / Livereload! "  Sizzle / mini.js! "  Jasmine! "  JSS / Stylus / Sass / LESS! http://flic.kr/p/7dpmyF! "  JSConsole / Weinre!
  • 44. What IS Kranium? "  A utility library to include in your app! "  A command line program!
  • 45. Utility library "  Exposes a jQuery-like object called K (or $)! "  Exposes Backbone integration! "  Exposes Jade template engine! "  Implements simple selector engine! "  Implements enhanced styling! "  Implements extendable modules!
  • 46. Command line program "  Built on NodeJS and NPM! "  Initiates Kranium resources in project! "  Pipes live updates! "  Two-way console! "  Jasmine reporter!
  • 47. Template engine A great template engine is a huge help in keeping your code:! "  DRY! "  separated! "  consise!
  • 48. Jade "  Lightweight! "  Supports custom compilers! "  Compiles templates to functions! "  Beautiful syntax! "  Consise! "  In active development!
  • 50. // test.jade view.board label.boardTitle Board view.boardMessages - each msg, user in users label.boardMessage= user + ' says ' + msg
  • 51. K.jade('test.jade', { users: { jacob: 'yeah', david: 'what', conny: 'hi', aida: 'hello', calle: 'yup' } });
  • 52. .board { top: 10; left: 10; } .boardMessages { top: 30; layout: vertical; } .boardMessage { height: 20; top: 10; } .boardTitle { top: 0; height: auto; font-weight: bold; }
  • 53. JSS "  Great feature in theory - gives Separation of Concerns! "  Hasn’t always been working well ! "  Not powerful and extendable enough!
  • 54. KSS "  A styling layer implemented in the javascript context! "  Everything created using K function is styled appropriately! "  Style based on Types, Classes and IDs! "  Platform branching using psuedo selectors! "  Variable evaluation!
  • 55. KSS label { color: #000; font-size: 16dp; } label:android { font-size: 17dp; text-align: left; } tableview:ios { style: Ti.UI.iPhone.TableViewStyle.GROUPED; }
  • 56. KUI http://flic.kr/p/6a3wzw! "  Extendable UI Modules! "  Simple Inheritance! "  Automatic KSS loading!
  • 57. Example kui/loginstatus.js! exports.Class = Label.extend({ className: "loginstatus", init: function(opts) { this.events = { app: { authchange: this.updateStatus.bind(this) } }; this._super.call(this, opts); this.updateStatus(); }, updateStatus: function(e) { this.el.text = "Logged " + (e && e.loggedIn ? "in" : "out"); } });
  • 58. Example kui/loginstatus.kss! .loginstatus { color: #f00; }
  • 59. Example app.js! K({ type: 'window', children: [{ type: 'loggedinstatus' }] }).open(); var i = 0; setInterval(function(){ Ti.App.fireEvent('authchange', { loggedIn: !!(++i % 2) }); }, 1000);
  • 60. Example app.js! K({ type: 'window', children: [{ top: 10, type: 'loggedinstatus' }, { bottom: 10, type: 'loggedinstatus' }] }).open(); var i = 0; setInterval(function(){ Ti.App.fireEvent('authchange', { loggedIn: !!(++i % 2) }); }, 1000);
  • 61. Backbone supplies structure to JavaScript-heavy applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions and views with declarative event handling...
  • 62.
  • 64. // Define model RowModel = Backbone.Model.extend({ type: 'tableviewrow' }); // Define collection RowCollection = Backbone.Collection.extend({ model: RowModel, comparator: function(model) { return model.get("title"); } }); // Create todos collection todos = new RowCollection(); todos.add([ { title: "An example todo" }, { title: "Another example todo" }, ]); // Create todolist var todolist = K.create({ type: 'todolist', collection: todos });
  • 65. // kui/todolist.js exports.Class = BackboneView.extend({ type: 'tableview', editable: true, events: { click: function(e){ var model = todos.getByCid(e.rowData._modelCid); model.set({ hasCheck: !model.get('hasCheck') }); }, "delete": function(e){ var model = todos.getByCid(e.rowData._modelCid); todos.remove(model); } } });
  • 66. exports.Class = Window.extend({ navBarHidden: true, init: function(o){ this.titleLabel = K.createLabel({ className: 'titleLabel' }); todos.bind('all', this.updateTitleLabel.bind(this)); this.updateTitleLabel(); this.children = [{ type: 'toolbar', className: 'todoToolbar', items: [{ type: 'textfield', className: 'todoInputTextField', events: { "return": function(e){ todos.add({ title: e.value }); } } }, 'spacer', this.titleLabel] }, todolist]; this._super(o); }, updateTitleLabel: function(){ var completed = todos.filter(function(m){ return m.get('hasCheck') }).length; this.titleLabel.text = completed + ' / ' + todos.length + ' todos'; } });
  • 67.
  • 68. Polyfill missing UI "  Android lacks many simple UI modules! "  Navbar! "  TabbedBar! "  ButtonBar! "  Toolbar! "  Extendable TabBar" "  Kranium implements these!
  • 71. Extend Base UI K.createTableview({ pullToRefresh: true, refresh: function(){ K.ajax({ url: 'http://example.com/service.json', success: this.render }); }, render: function(data){ this.setData(data.rows.map(this.createRow)); }, createRow: function(o){ return K.createTableViewRow({ title: o.name }); } });
  • 72. Livetanium "  Kranium integrates Livetanium! "  Gives you live updates of KSS style changes as well as module updates!
  • 73.
  • 74. Jasmine describe('Demo', function() { describe('Titanium Object', function(){ it('Ti == Titanium', function(){ expect(Titanium).toEqual(Ti); }); it('Ti.App', function(){ expect(Titanium).toBeDefined(); }); }); describe('TabGroup', function(){ it('Has tabgroup', function(){ expect(K('tabgroup').length).toBeGreaterThan(0); }); it('TabGroup.activeTab.title === "test"', function(){ expect(K('tabgroup').get(0).activeTab.title).toEqual("test"); }); }); });
  • 75.
  • 77.
  • 78. Summary "  Consists of a command line program and an includable library! "  Ports the best web development libraries and technologies to Titanium! "  Polyfills parts missing between platforms! "  Helps you with your KISS:ing and keeps you DRY!
  • 79. Available now "  Currently in open beta! "  Source under MIT License! "  Hosted on GitHub! "  Pull requests and co-maintainers welcome" "  http://github.com/krawaller/kranium!
  • 80. Available now "  Beware! "  There will be bugs! "  API far from frozen!
  • 81. Available now "  Works best with iOS, but Android getting there! "  CLI works best on Mac OSX! "  Will be tested and fixed for Linux and Windows !
  • 83. Installation "  1. Install NodeJS and NPM! "  2. Run `npm install kranium`! "  3. There is no step 3!
  • 85. Thank you + @litenjacob! jacob@krawaller.se! jacob.waller@logica.com!
  • 86. Go contribute please! http://flic.kr/p/9C7DZZ!