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/For Users/Advanced/JavaScript Contexts in NW.js.md
+4-4Lines changed: 4 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -46,7 +46,7 @@ Different windows and frames have different contexts. So when you create a new f
46
46
47
47
Some objects of Node context are copied to Browser context so that scripts running in Browser context can access Node.js objects:
48
48
49
-
*`nw` -- the object of all [NW.js APIs](../../References)
49
+
*`nw` -- the object of all NW.js APIs in **`References`** section
50
50
*`global` -- the global object of Node Context; same as `nw.global`
51
51
*`require` -- the `require()` function for loading Node.js modules; similar to `nw.require()`, but it also supports `require('nw.gui')` to load NW.js API module.
52
52
*`process` -- the [process module](https://nodejs.org/api/globals.html#globals_process) of Node.js; same as `nw.process`
@@ -74,7 +74,7 @@ Scripts running in the Node context can use [JS builtin objects]() like browse
74
74
**All node modules shares a same Node context in separate context mode**. But you have several ways to create new Node contexts:
75
75
76
76
* Set `new_instance` option to `true` when creating window with [`Window.open()`](../../References/Window.md#windowopenurl-options-callback)
77
-
* Start NW.js with `--mixed-context` CLI option to turn NW.js into [Mixed Context mode](#mixed-context)
77
+
* Start NW.js with `--mixed-context` CLI option to turn NW.js into [Mixed Context mode](#mixed-context-mode)
78
78
79
79
#### Access Browser and NW.js API in Node Context
80
80
@@ -96,7 +96,7 @@ In the browser side (index.html):
96
96
<script>
97
97
var myscript =require('./myscript');
98
98
// pass the `el` element to the Node function
99
-
myscript.setText(document.getElementbyId('el'));
99
+
myscript.setText(document.getElementById('el'));
100
100
// you will see "hello" in the element
101
101
</script>
102
102
```
@@ -110,7 +110,7 @@ Relative paths in node modules are resolved according to path of that module (li
110
110
111
111
## Mixed Context Mode
112
112
113
-
Mixed context is introduced in NW.js 0.13. When running NW.js with [`--mixed-context` CLI option](../../References/Command Line Options.md#mixedcontext), a new Node context is created at the time of each browser context creation and running in a same context as browser context, a.k.a. the Mixed context.
113
+
Mixed context is introduced in NW.js 0.13. When running NW.js with [`--mixed-context` CLI option](../../References/Command Line Options.md#-mixed-context), a new Node context is created at the time of each browser context creation and running in a same context as browser context, a.k.a. the Mixed context.
0 commit comments