Permalink
Browse files

Document how to pass objects from Node to the page.

Closes #443.
  • Loading branch information...
1 parent c859c8a commit 3a4466f5c278120d016f30ebb90bad1ac4064310 @domenic domenic committed Oct 11, 2012
Showing with 16 additions and 0 deletions.
  1. +16 −0 README.md
View
@@ -264,6 +264,22 @@ jsdom.jQueryify(window, "http://code.jquery.com/jquery.js", function () {
});
```
+## Passing objects to scripts inside the page
+
+```js
+var jsdom = require("jsdom").jsdom;
+var window = jsdom().createWindow();
+
+window.__myObject = { foo: "bar" };
+
+var scriptEl = window.document.createElement("script");
+scriptEl.src = "anotherScript.js";
+window.document.body.appendChild(scriptEl);
+
+// anotherScript.js will have the ability to read `window.__myObject`, even
+// though it originated in Node!
+```
+
# Test Compliance:
```

0 comments on commit 3a4466f

Please sign in to comment.