Chapter 15.1.7. Working with Timers

Although this chapter is mostly about Ajax, it turns out that some of the same concepts apply to timers. The section on Deferreds talked about how a Deferred object is a promise for something that will happen later. By definition, when you put a timer on a web page, you’re saying that you want something to happen later.

If PizzasForYou offers a 30-minute delivery guarantee, the order confirmation page can pop up an alert when the pizza should have arrived. Here’s how to do that:

function pizzahere(pizza_description) { alert("Your " + pizza_description + " pizza should have arrived!"); } // The following function would likely have been called from a button // press that confirms the order function orderpizza() ...

Get Rapid Web Applications with TurboGears: Using Python to Create Ajax-Powered Sites now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.