Mindblown: a blog about philosophy.

  • Conclusion

    In this lesson we introduced you to promises, a better pattern for dealing with asynchronous code. Promises enable you to avoid having to use nasty tricks to synchronize parallel asynchronous functions and the need to nest callbacks inside callbacks inside callbacks. We outlined the Promises/A and the Promises/A+ proposals and explained how they compare with…

  • Promisifying all the things

    The previous sections focused on the Deferred and Promise objects and their methods, but we’ve reserved another small surprise for you: the promise() method. The latter is different from the deferred.promise() method that you learned a few pages back. promise() allows you to transform a jQuery object into a Promise object, enabling you to add handlers using the methods discussed in this lesson. The syntax of this…

  • Using the Promise object

    In order to master Deferreds and Promises you have to understand when to use one and when the other. To help you understand this topic, let’s say that you want to implement a promise-based timeout function. You are the producer of the function. In this case, the consumer of your function doesn’t need to care about resolving or rejecting it. The consumer…

  • The Deferred methods

    In jQuery, a Deferred object is created by calling the $.Deferred() constructor. The syntax of this function is as follows. Method syntax: $.Deferred $.Deferred([beforeStart]) A constructor function that returns a chainable utility object with methods to register multiple callbacks into callback queues, invoke callback queues, and relay the success or failure state of any synchronous or asynchronous function. It…

  • The Deferred and Promise objects

    The Deferred object was introduced in jQuery 1.5 as a chainable utility used to register multiple callbacks into callback queues, invoke callback queues, and relay the success or failure state of any synchronous or asynchronous function. Since then, it has been subject to discussions, some criticisms, and a lot of changes along the way.[1] This object can be used…

  • Introduction to promises

    In real life, the one away from computers (yes, there is something more out there), we often talk about promises. You ask people to make you a promise or you’re asked by others to promise something. Intuitively, a promise is a commitment derived from a request you make to ask a person to perform a…

  • Avoiding the callback hell with Deferred

    This lesson covers For a long time, JavaScript developers have used callback functions to perform several tasks such as running operations after a given amount of time (using set-Timeout()), or at regular intervals (using setInterval()), or to react to a given event (click, keypress, load, and so on). We’ve discussed and employed callbacks extensively to perform asynchronous operations; for…

  • Conclusion

    In this lesson we described the fundamental concepts of software testing and why unit-testing your code is so important. Testing gives you more confidence that your code is working properly and that it (virtually) doesn’t have bugs. We provided an overview of the frameworks available for unit testing JavaScript projects, focusing our attention on QUnit.…

  • An example test suite

    In this last section you’ll build a complete test suite for a project, and what’s better than testing something you’ve developed in this very app? That’s why you’ll create a test suite for Jqia Context Menu, the jQuery plugin you built in lesson 12 to show a custom context menu on one or more specified elements of…

  • Configuring QUnit

    In the same way that jQuery has a lot of reasonable default values for many of its methods, QUnit is released with a preset configuration. Sometimes you may need to tweak this configuration a bit to satisfy your project-specific needs. The framework allows you to override these default values, exposing them through a property called config. Table…

Got any book recommendations?