Wire.js is an Inversion of Control Container for Javascript apps.
As cujo.js’s application composition layer, it provides a well-defined place for creating, configuring, and non-invasively connecting together the components of an application, or sections of an application.
With wire.js, you focus on coding the application logic of components and let wire.js handle the bootstrapping and the glue that connects them together. You write simple, declarative JSON (or Javascript) that describes how components should be composed together, and wire will load, configure, and connect those components to create an application, and will clean them up later.
Wire.js provides:
- Simple, declarative dependency injection
- A flexible, non-invasive connection infrastructure
- Application lifecycle management
- Powerful core tools and plugin architecture for integrating popular frameworks and existing code.
- Support for both browser and server environments
Apps constructed with wire.js:
- Have a high degree of modularity
- Can be unit tested easily, because they inherently separate application logic from application composition
- Allow application structure to be refactored independently from application logic
- Have no explicit dependencies on DOM Ready, DOM query engines, or DOM event libraries
TodoMVC, the web's new "hello world", implemented using cujo.js shows how wire.js is used to create application components and compose them together.
Hello Wire is a very simple introduction to wire.js. You can fork and run the application, look at the code, and read the walkthrough.
The UI for this "Monty Hall Problem" game is built with cujo.js. The application was used as a demo during several talks at SpringOne 2GX.
This is a simple notes app built as a demo for Dojoconf 2011 using cujo.js. It shows several more advanced aspects of wire.js, such as dividing an application into sections that can be wired on-demand, Aspect Oriented Programming (AOP), and Dojo integration via wire.js plugins.