Chapter 11. In the browser

 

This chapter covers

  • Building browser-based programs
  • Creating polyfills for cross-browser compatibility
  • Building retained- and immediate-mode interfaces
  • Structuring browser-based programs

A web browser can be a hostile environment in which to run a program, but CoffeeScript can help you keep your browser-based applications manageable. It’s not the individual features of CoffeeScript that help you in a browser. Instead, it’s the focus on simplicity and clarity of expression and semantics that help you to keep your sanity in the world of web browsers, which can at times seem insane. That said, although the benefit of CoffeeScript in a browser is in how you use it to structure programs, it’s still important to learn the challenges of the browser environment that your CoffeeScript programs live in.

In this chapter you’ll learn how to write browser-based programs in CoffeeScript that run on multiple, often incompatible, browsers. To get there you’ll learn how to deliver your CoffeeScript to a browser, how to deal with browsers that don’t support the features you need, how to create user interfaces using retained- and immediate-mode techniques, how to create animations, and how to manage the structure of your program and how fast it runs. It’s time to get started.

11.1. Getting started

11.2. Communicating with the outside world

11.3. Cross-browser compatibility

11.4. Creating a user interface

11.5. Creating animations

11.6. Structuring programs

11.7. Summary