README.md

Please Note: this project has moved from briancavalier/wire to cujojs/wire.
Any existing forks have been automatically moved to cujojs/wire. However,
you'll need to update your clone and submodule remotes manually.

Update the url in your .git/config, and also .gitmodules for submodules:

wire.js

With wire.js, you can focus on coding the business logic of your components and let wire.js handle the bootstrapping and the glue that connects them together. You write a simple wiring spec in JSON (or Javascript) that describes how your components should be wired together, and wire will load, configure, and connect those components to create your application, and will clean them up later.

Specifically, wire.js provides:

Component lifecycle management

Dependency Inversion via constructor and setter Dependency Injection

Automatic dependency ordering

Connectors

Service locator pattern and reference resolution

Plugins

Wire.js also has a plugin architecture that allows plugins to provide new capabilities to wire.js and syntax to wiring specs. Here are some of the capabilities provided by the bundled plugins:

Dependency Injection for DOM nodes. For example, you can reference DOM nodes by id or dom query, and inject them into your views.

Event and PubSub connectors. Write your components without any glue code, and connect them together in the wiring spec using events or pubsub. The event connector works for DOM nodes, too!

Aspect Oriented Programming (AOP). Wire.js comes with an AOP plugin that allows you to declaratively apply decorators, before/after/around advice, and to introduce mixins on the fly.

Framework integration

Plugins also allow you to use capabilities of your existing modules/libraries/frameworks. For example, wire.js has a set of plugins for Dojo that allow it to integrate with Dijit's widget system, to use dojo.connect as the event connector, and dojo.publish/subscribe as the pubsub connector. If you are already using those aspects of Dojo, you can use wire.js's Dojo plugins to integrate easily with all your existing components.

wire/dom plugin now supports options for adding/removing classes to <html> during wiring.

Now using when.js v0.9.3 for promises and async handling. See also the Deprecated Functionality below.

The wire.js core is now only 2.5k with Google Closure + gzip!

Limited support for using wire in a non-AMD setup. This is intended to aid in transitioning to AMD and CommonJS modules, and it's unlikely that wire's full functionality will ever be extended to cover non-AMD/CommonJS environments.

wire.js can now create components using raw constructors in addition to AMD module ids. This allows wire.js to create components instances from libraries that haven't yet fully committed to AMD or CommonJS.

The components in the current context will always be in an incomplete state, and relying on this is potentially dangerous.

I may consider allowing injecting a promise for the current context, which would resolve after the current context has finished wiring.

If you were using the wire() method of a context injected via { $ref: 'wire!context' }, you can use { $ref: 'wire!' } instead, which provides a direct reference to the wire() method itself--i.e. it injects a function that works just like context.wire().

Many plugin methods received a wire parameter that had several promise helper methods, such as wire.when, wire.whenAll, etc. These are deprecated in favor of simply using when.js instead, which is provided as a submodule in the support dir.