Async

This Event

Modular JavaScript with RequireJS

@ The Skiff 6 Gloucester Street, Brighton, BN1 4EW Map of The Skiff

Sorry, all in person events are cancelled until further notice due to COVID-19 (Coronavirus).

legos by huladancer, on Flickr

In this session, Kyran Dale gives a practical introduction to RequireJS, an open-source library for creating modular JavaScript applications. With RequireJS, code can be organised into separate modules that can be loaded asynchronously in the browser, without polluting the global namespace.

Unlike more traditional programming languages, JavaScript has no built-in ability to import modules of code with protected namespaces. Scripts are strung together on the DOM in a global soup, and namespaces are usually described by the convention of having a single global object contain the functionality for a library or API. Naming collisions and messy code architecture can be the result.

As programmers start to craft large JavaScript libraries and applications, and as JavaScript development moves server-side with projects like Node.js, the need for a way to structure code in a modular form becomes more pressing.

We'll take a look at how to use RequireJS, the questions it raises, some proposed alternatives and the motivation for having modular code shared by the client and server.

RequireJS is an open source project created by Mozilla and Dojo's James Burke and can be forked on GitHub. For more information, see requirejs.org

Following Event

View all events

Previous Event

View all events