Hyperloop & NPM

Last month CEO Jeff Haynie spoke at the Amsterdam Titanium meetup I’m co-leading. The subject was of course Hyperloop, the foundation under Titanium 4.x also known as Ti.Next. Watch it here:

More native, more JS

Leading up to the meeting, I had a chat with Jeff about an interesting feature he also mentions in the video. Hyperloop will make Titanium more native then ever, but also more standard JavaScript at the same time. As an example, the API will now be fully prototypal, and because it’s all (Hyperloop) JavaScript you can extend every bit of it without touching Objective-C or JAVA.

NodeJS require

But what I find maybe even more exciting is that it will implement the full NodeJS require specs. There’s an example in the Hyperloop repository demonstrating this. This means Titanium can require the index.js by it’s directory name, require from a project’s local node_modules folder, but also a global one.

NPM

In turn, this means you can drop a package.json file with dependencies in your project directory, run npm install and have NPM install packages like lodash and all their dependencies to the local or global node_modules folder.

Titanium Modules

In Hyperloop there will be no such thing as native modules written in Objective-C or JAVA like we do now. Just as the Ti.Next API, all modules will be written in (Hyperloop) JavaScript just like you would now write a CommonJS module. And yes, you could just publish these modules on NPM and add them as dependencies to your projects!

Alloy widgets

Another area that would benefit from NPM is Alloy. Already before it was stable, in July 2012 Tony and Jeff knew Alloy would need some kind of widget dependency management and as you go through the discussion under the related ticket you’ll see NPM arose as the logical solution there as well. This means Alloy will need some modifications done to be able to load widgets, but possibly also builtins and sync adapters from modules placed in the local or global node_modules folder.

NodeJS itself

Of course a lot of packages on NPM depend on NodeJS core modules like fs, path etc. These obviously wouldn’t normally work in a Titanium environment, but as you’ll hear Jeff saying in the video Appcelerator is actually planning on writing an Hyperloop version of the full NodeJS core API in a later stadium! This will open it up for even more modules and would let you use something like wrench to traverse files on the device!

Titanium 3.x

We still have maybe as long as one year to go until Ti.Next will be ready for production builds. I’m convinced the above will spur a whole new wave of new Titanium modules and Alloy widgets and other components, as well as solving the problem of re-using proprietary components. Therefor, I’ve opened a ticket requesting this to be implemented in Titanium 3.x. Please watch the ticket with me and add your comments and maybe we can enjoy these new features earlier next year!

App imagineer: Imagining, Engineering & Speaking about Native mobile Apps with Appcelerator Titanium & Alloy • Meetup organizer • Certified Expert • Titan


Comments

  • Jamesc

    Thanks for posting the video, and highlighting the keypoints, Writing modules in js would be awesome.
    Question: I’ve gotten used to the whole tishadow workflow, will the new architecture impact how tishadow works?

  • Fokke Zandbergen Post author

    We did ask this question to Jeff and he confirmed it will still be possible to run code sent to the device after installing an app so that means TiShadow would be able to (made to) work with Ti.Next.

  • facebook business page

    Fantastic difficulties completely, you just obtained the latest viewer. What exactly may perhaps an individual propose with regards to your create you made at times ago? Any constructive?