Sencha Touch

From Wikipedia, the free encyclopedia
Jump to: navigation, search
Sencha Touch
P14.png
A Sencha Touch app with an iOS6 theme
Developer(s) Sencha
Stable release
2.4.2 / June 15, 2015; 15 months ago (2015-06-15)
Development status Active
Written in JavaScript
Operating system Android, iOS, BlackBerry, Kindle, Windows Phone, Tizen
Available in English
Type JavaScript library
License GPLv3 or commercial
Website www.sencha.com/products/touch
Repository no%20value

Sencha Touch is a user interface (UI) JavaScript library, or web framework, specifically built for the Mobile Web. It can be used by Web developers to develop user interfaces for mobile web applications that look and feel like native applications on supported mobile devices. It is based on web standards such as HTML5, CSS3 and JavaScript. The goal of Sencha Touch is to facilitate quick and easy development of HTML5 based mobile apps which run on Android, iOS, Windows, Tizen and BlackBerry devices, simultaneously allowing a native look and feel to the apps.

Version history and support[edit]

Sencha Touch is a product of Sencha, which was formed after popular JavaScript library projects Ext JS, jQTouch and Raphaël were combined. The first release of Sencha Touch, version 0.90 beta, was made available on July 17, 2010. This beta release supported devices running Android, and iOS (on iPhone, iPod touch, iPad).

Subsequently, the first stable version, 1.0, was released in November 2010. Version 1.1.0 added support for devices running BlackBerry OS 6.0.

The latest release, Sencha Touch 2.4.2, was released in June 2015 [1] and is designed to run on the following browsers and platforms:

There are no announced plans to support Firefox Mobile.

Features[edit]

MVC Architecture[edit]

Sencha Touch follows MVC Pattern which separates the application data, the control code and view. This separation allows large scale applications to be flexible and easy to maintain.

Widget Components and Customisable themes[edit]

Sencha Touch has an inbuilt DOM manipulation interface which negates the dependency on other UI frameworks like jQuery.It includes a set of graphical user interface GUI-based controls (or components) for use within mobile web applications. These components are optimized for touch input. The components are:[2]

  • Buttons with device specific themes and effects
  • Form elements such as text fields for email
  • Date picker and address
  • Sliders, selectors, and combo-boxes
  • A list component with momentum-scrolling and an index bar
  • A minimal icon set
  • Toolbars and menus
  • Movable tabs, bottom toolbars
  • A map component with support for multi-touch gestures such as pinch and zoom
  • Carousels

All the components can be themed according to the target device. This is done using Sass, a stylesheet language built over CSS. Some of the native-lookalike themes are Cupertino Classic (for iOS6.x and below), Cupertino (for iOS 7) and Mountain View (for Android).[1]

Transitions, Animations and adaptive UI[edit]

Sencha Touch has eight in-built transition effects including slide over or under the current element, pop, flip, and cube. It supports common touch gestures built from touch events, which are Web standards but supported only by Android, iOS, and some touch enabled devices. These are tap, double tap, swipe, scroll, and pinch.

Since Sencha touch is HTML5 based, the layouts it offers are extremely adaptive in nature.

Charting[edit]

Sencha Touch also supports charting components including pie charts, bar graphs, line series, etc. with explanatory legends. These components support interactivity like pinch and zoom. Just like the Grid components in ExtJS, Sencha Touch offers TouchGrid functionality.

Profiles[edit]

Profiling in Sencha Touch allows you to create different profiles catering to different screen sizes. When the application is loaded, the framework determines the type of device, and its corresponding profile determines which components and functionality need to be swapped out, and the specific views and controllers that need to be invoked, saving the developer the task of creating a different application for each type of device.[3]

Basic Application Directory Structure[edit]

Sencha Touch applications have a basic file and directory structure as follows:[2][2]

Directory/File Description
app The main directory that holds the app's models, views, controllers, stores and profiles
app.js File that holds the application's overall settings. References to all models, views, controllers, stores and profiles can be found here. Once these references are loaded, the main app launch function is called. This function loads the first view and hence can be considered as the first point of the application
index.html Main HTML file for the app. It may span many pages/screens for the mobile app
resources Directory that holds all the images, css and any other external file that the app needs
app.json App's configuration file
packager.json File used to create native packages
ext-touch.js This is Sencha's JavaScript library (ext-touchdebug.js recommended during development phase)
ext-touch.css This is Sencha's CSS library

Developer Tools and Plugins[edit]

Sencha Touch provides IDE plugins for ease of development. Benefits of these plugins include code generation[disambiguation needed] and auto-completion, code refactoring and ease of navigation to framework codebase and custom classes. Sencha Touch has plugins for popular IDEs like JetBrains, Visual Studio and Eclipse.

There is a visual app builder, Sencha Architect, for building cross platform HTML5 apps. It provides addiction features like theming and command line integration.

Sample Usage[edit]

Sencha Touch makes it convenient to use a map in your application using the Ext.Map component. The inclusion of "Google Maps API" Javascript file is essential for the GoogleMaps API to work.[4]

<!DOCTYPE HTML>
<html>
<head>
<title>Touch Test</title>

<!-- sencha touch css -->
<link rel="stylesheet" type="text/css"
         href="sencha-touch/resources/css/sencha-touch-debug.css" />

<!-- Google Maps API -->
<script type="text/javascript"
              src="//maps.google.com/maps/api/js?sensor=true"></script>

<!-- sencha touch javascript -->
<script type="text/javascript" src="sencha-touch/sencha-touch-debug.js"></script>

<!-- application script -->
<script type="text/javascript">
  Ext.setup( {
    onReady: function() {
      // create the root panel
      new Ext.Panel({
        fullscreen: true,
        items: [
          {
            xtype: "map"  
          }
        ]
      });
    }
  });
</script>

</head>

<body>
</body>
</html>

Ext.setup() is the starting point to initialise the application, setting up the viewport and the event system.

Comparison to native applications[edit]

Sencha Touch supports PhoneGap and Apache Cordova APIs for Accelerometer, Camera, Compass, Geolocation, Capture, InAppBrowser, Media, Notification, Splash Screen, Storage (SQLite), etc. which were previously accessible only to native applications. Sencha Touch leverages Javascript to create most of the UI components and change CSS of DOM elements on the fly. With Javascript Engines being more efficient and faster than before, web apps run almost as smooth as native apps.

See also[edit]

References[edit]

  1. ^ http://www.sencha.com/blog/announcing-sencha-touch-2-4-2-with-improved-blackberry-10-3-experience/
  2. ^ a b Allen, Sarah; Graupera, Vidal; Lundrigan, Lee (2010). Pro Smartphone Cross-Platform Development. United States of Amercia: APress. p. 226. ISBN 978-1-4302-2869-1. 
  3. ^ Clark, John Earl; Johnson, Bryan P. (April 2013). Creating Mobile Apps with Sencha Touch 2. Birmingham UK: Packt Publishing. pp. 233, 234. ISBN 978-1-84951-890-1 – via Ebrary.com. 
  4. ^ "IBM Developer Works- Build mobile web applications with Sencha Touch". 

Bibliography[edit]

External links[edit]