I recently took the time to checkout out Appcelerator’s Labs page where they allow users try out pre-release software. There are some interesting projects here, but I spent most of my time experimenting with Hyperloop, which could be the best new feature in Titanium.

The Hyperloop module will allow developers to interact with native API’s directly from their JavaScript code! Titanium already covers the majority of native API’s, but some more complicated projects need API’s that are not covered. Hyperloop will make interacting with the API’s not directly covered by Titanium much easier than it has been in the past.

Hyperloop will also make it easier to use third party Android libraries or iOS cocoapods. These can be added to a Titanium project, and Hyperloop will make the library available inside the JavaScript code without having to write a native module.

There is a lot of work that goes into developing and maintaining a native module because there are two different code bases. Debugging native modules can be more time consuming when going back and forth between the native module and the Titanium project. Since Hyperloop will put the native API interaction alongside the rest of the Titanium JavaScript code, maintaining the project should be much easier.

I think Hyperloop will be one of the best additions to Appcelerator’s arsenal, but there are some improvements I would like to see before its final release.

In a typical project using Hyperloop, I might write something like this if I needed to require some native Android API’s:

var View = require('android.view.View'),
  Color = require('android.graphics.Color'),
  LayoutParams = require('android.widget.FrameLayout.LayoutParams');

A more complicated example that uses a lot of native API’s could look like this:

var FrameLayout = require('android.widget.FrameLayout'),
  ViewGroupLayoutParams = require('android.view.ViewGroup.LayoutParams'),
  Color = require('android.graphics.Color'),
  Gravity = require('android.view.Gravity'),
  View = require('android.view.View'),
  Activity = require('android.app.Activity'),
  LayoutParams = require('android.widget.FrameLayout.LayoutParams');

This looks a little messy. I would like to see ES6 style destructuring and object matching. That could make the code above look something like this:

var {
  widget : {
    FrameLayout,
  },
  view : {
    ViewGroup,
    Gravity,
    View
  },
  graphics : {
    Color
  },
  app : {
    Activity
  }
} = require(‘Android');

This could make the code much more readable as classes from the same package will be grouped together, and var’s with matching names will be created automatically.

Class inheritance is another ES6 feature that would be a good addition for Hyperloop. Inheritance is a big part of the Objective-C and Java programming languages. This allows the developer to modify the class’s function’s, but the original function definition is still available by calling the super() function. I think Hyperloop can work without class inheritance, but being able to extend the native classes from within the JavaScript code would be a huge advantage.

I, personally, cannot wait to start using Hyperloop in my daily development here at Shockoe. I think it will not only let me make more powerful applications that harness more native API’s, but it will also save me time when using third party libraries. Fewer native modules means less code to maintain down the line when operating systems and SDK’s are updated.

I think Appcelerator has a great product in development, and with a few improvements, it will be invaluable to the Appcelerator developer community.

Sign up for the Shockoe newsletter and we’ll keep you updated with the latest blogs, podcasts, and events focused on emerging mobile trends.