Free Sample
+ Collection
Code Files

Getting Started with Twitter Flight

Tom Hamshere

Build scalable, modular JavaScript applications with the Twitter Flight framework
RRP $17.99
RRP $29.99
Print + eBook

Want this title & more?

$12.99 p/month

Subscribe to PacktLib

Enjoy full and instant access to over 2000 books and videos – you’ll find everything you need to stay ahead of the curve and make sure you can always get the job done.

Book Details

ISBN 139781783280957
Paperback130 pages

About This Book

  • Learn how to build scalable, maintainable, modular applications with Flight, Twitter’s cutting-edge JavaScript framework
  • Work through building a simple application from scratch with clear, step-by-step examples
  • Leap ahead of the learning-curve with best practice examples from an experienced Flight developer

Who This Book Is For

This book is for anyone with a foundation in JavaScript who wants to build web applications. Flight is quick and easy to learn, built on technologies you already understand such as the DOM, events, and jQuery.

Table of Contents

Chapter 1: What is Flight?
Who made Flight?
How does Flight work?
Chapter 2: The Advantages of Flight
Efficient complexity management
Agnostic architecture
Improved Performance
Well-organized freedom
Chapter 3: Flight in the Wild
Flight at Twitter
Quotes from developers
Open source Flight projects
Extending Flight with two-way data binding
Chapter 4: Building a Flight Application
Scaffolding a Flight application with Yo
Creating custom applications
Using Flight without a module loader
Chapter 5: Components
What is a component?
Component types
Creating your first component
Chapter 6: UI Components
Attaching components to existing HTML
Listening for browser events
Finding DOM nodes
Modifying the DOM
Chapter 7: Data Components
What is a data component?
Attaching data components
Naming data events
Creating a data component
Listening for UI events
Event handlers
Triggering data events
Completing the task_data component
Error handling
Handling data events
Chapter 8: Event Naming
The importance of event names
Events are not instructions
Suggested naming conventions
Chapter 9: Mixins
What are mixins?
When to use mixins
How do mixins work?
Creating mixins
Using mixins
Mixin priority
Creating your first mixin
Initializing the task list from storage
Extending existing methods
Advice priority for components and mixins
Mixing mixins into mixins
Chapter 10: Templating and Event Delegation
Generating template objects from DOM nodes
Constructing templates in components
Creating a templating mixin
Server-side compilation
Using HTML to determine state
Working with dynamic HTML – event delegation
Adding delegated events to task_list
Chapter 11: Web Application Performance
Reducing time to page load
Server-side rendering
Using the DOM to determine state
Using request type to determine response
Perceived performance
Chapter 12: Testing
What does a test look like?
Testing the interface
Obtaining a reference to a component instance
Instantiating standalone mixins
Triggering browser events
Allowing for refactoring
Testing teardown
Testing component instantiation
Extending Jasmine for Flight
Chapter 13: Complexities of Flight Architecture
The danger of nested components
Creating a flat component structure
Mixins versus components

What You Will Learn

  • Architect reliable, scalable, component-based applications with Flight
  • Design and build data components for storage and processing
  • Create UI components to handle browser events and modify the DOM
  • Use client-side templating and event delegation to create HTML on the fly
  • Test Flight components by building extensions for the Jasmine test framework

In Detail

Flight is a lightweight, component-based JavaScript application framework developed by Twitter for It is an exciting alternative to the complexities of modern MVVM frameworks, offering a minimal API that allows you to write fast, reliable, scalable applications with a minimum of boilerplate code.

Getting Started with Twitter Flight offers the reader insight into why Flight was created and how to use it to build performant, powerful web apps from a unique perspective – that of someone who has had the opportunity to work directly with the team that created it. From a basic knowledge of JavaScript and jQuery, you will explore every aspect of Flight through practical examples and detailed explanations.

Learn what separates Flight from other frameworks, why Flight was created, and why you should use it in your next project. Discover the power of Flight’s component-based architecture and use mixins, an exciting alternative to class-based inheritance, to create templating systems and data storage layers.

Getting Started with Twitter Flight provides all you need to know to build everything from UI widgets to large-scale, data-driven applications.


Read More