Labs/Jetpack/JEP/29: Difference between revisions

Jump to navigation Jump to search
(added section on dependency injection)
Line 39: Line 39:
=== Dependency Injection ===
=== Dependency Injection ===


The manifest is essentially used as a high-level specification that guides the injection of dependencies into the Jetpack's global environment. For instance, if the manifest doesn't specify that the Jetpack needs access to the network, then the <tt>XMLHttpRequest</tt> object won't be inserted into the Jetpack's global scope; if the manifest specifies that the Jetpack only needs to communicate with foo.com, then <tt>XMLHttpRequest</tt> will be attenuated such that connections to domains other than foo.com will fail.
The manifest is essentially used as a high-level specification that guides the injection of dependencies into the Jetpack's global environment.
 
For instance, if the manifest doesn't specify that the Jetpack needs access to the network, then the <tt>XMLHttpRequest</tt> object won't be inserted into the Jetpack's global scope&mdash;or perhaps a "dummy" object that raises a helpful security error when accessed will be injected in its place.
 
Alternatively, if the manifest specifies that the Jetpack only needs to communicate with foo.com, then <tt>XMLHttpRequest</tt> will be injected but attenuated such that connections to domains other than foo.com will fail.


=== Extenders ===
=== Extenders ===
874

edits

Navigation menu