You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/concepts.md
+24Lines changed: 24 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -130,6 +130,30 @@ The second references the `message` String (the first item in the wire spec):
130
130
131
131
When you feed a spec to wire.js, it will create a [context](#contexts) containing fully realized versions of the components in the spec. In the Hello Wire case, the context will contain the message String, an *instance* of the `HelloWired` object from the `app/HelloWire` AMD module, and an Array with one element--the `wire/dom` plugin AMD module.
132
132
133
+
### Assembling applications
134
+
135
+
In addition to [Application composition](#application-composition), Wire.js helps you assemble large application from parts using the `$imports` keyword.
136
+
137
+
You may decide to decompose your large application into domains (transacting, settling, accounting, ...). You may also decide to decompose each domain into layers (presentation, business, infrastructure, ...). Let's call a layer of a domain an *application part*. Each application part would be developed, tested and wired in isolation.
138
+
139
+
To build an application, you will select the appropriate parts and assemble them together. To do so, all you need is import the spec of each selected part within the spec of the final application.
140
+
141
+
The spec of the final application would be as follows:
142
+
143
+
```javascript
144
+
define({
145
+
$imports: [
146
+
'utils-spec',
147
+
'commons-spec',
148
+
'transaction-spec',
149
+
'settlement-spec',
150
+
'accounting-spec',
151
+
]
152
+
});
153
+
```
154
+
155
+
Reading the above spec, Wire.js will first inline the content of each imported spec then process the result.
156
+
133
157
## Contexts
134
158
135
159
As the result of processing a spec, wire.js produces a **Context**. The context is a Javascript Object that contains the fully realized components that were specified in the wiring spec. The context also has methods for wiring child contexts, resolving references, and destroying the context and all the objects, etc. that were created when it was wired.
0 commit comments