Skip to content

Commit edefe04

Browse files
Update FAQ.md
1 parent 7ee7d57 commit edefe04

File tree

1 file changed

+29
-3
lines changed

1 file changed

+29
-3
lines changed

docs/For Users/FAQ.md

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,18 @@
33

44
[TOC]
55

6+
67
## console.log doesn't output to Linux terminal
78
`--enable-logging=stderr` should be used in the command line; See more here: https://www.chromium.org/for-testers/enable-logging
89

10+
911
## `var crypto = require('crypto')` gets a wrong object
10-
Chromium has its own global `crypto` object which can't be overwritten. So you can't use the same variable name `crypto`. Changing your variable name to something else, like `nodeCrypto`, will work.
12+
13+
Chromium has its own global `crypto` object which can't be overwritten. So you can't use the same variable name `crypto`. Changing your variable name to something else, like `nodeCrypto`, will work.
14+
1115

1216
## Images are broken in AngularJS and receive `Failed to load resource XXX net::ERR_UNKNOWN_URL_SCHEME` in DevTools
17+
1318
AngularJS added `unsafe:` prefix for unknown scheme to prevent XSS attack. URLs in NW.js and Chrome apps are started with `chrome-extension:` scheme, which is unknown to AngularJS. The solution is to config the whitelist of known schemes with AngularJS by adding following lines:
1419

1520
```javascript
@@ -20,8 +25,10 @@ myApp.config(['$compileProvider',
2025
}]);
2126
```
2227

23-
## Can't see exception reporting in AngularJS 2
24-
AngularJS 2 tries to register exception handlers in global variable `global`. However it's already existed in NW.js environment, which prevents exception reporting shown in DevTools. The workaround is to rename `global` to something else before loading any AngularJS libraries. For example,
28+
29+
## Can't see exception reporting in AngularJS 2+
30+
31+
AngularJS 2 tries to register exception handlers in global variable `global`. However, it's already existed in NW.js environment, which prevents exception reporting shown in DevTools. The workaround is to rename `global` to something else before loading any AngularJS libraries. For example,
2532

2633
```html
2734
<script>
@@ -31,7 +38,13 @@ window.global = undefined;
3138
<!-- Angular 2 Dependencies -->
3239
```
3340

41+
* See also:
42+
* [Tutorial: Angular-CLI and NW.js](https://dev.to/thejaredwilcurt/angular-cli-and-nwjs-for-development-49gl)
43+
* [NW.js + Angular 8 demo repo](https://github.com/nwutils/nw-angular-cli-example)
44+
45+
3446
## How to leave fullscreen mode with ESC key?
47+
3548
Usually users expect to use ESC key to quit fullscreen mode. By default, NW.js don't bind ESC shortcut for leaving fullscreen mode, but providing APIs for entering and leaving fullscreen mode. It will give developers more control on fullscreen mode.
3649

3750
To enable ESC key for leaving fullscreen mode, you can use [Shortcut API](../References/Shortcut.md):
@@ -47,3 +60,16 @@ nw.App.registerGlobalHotKey(new nw.Shortcut({
4760
}));
4861
```
4962

63+
## How do I get "intellisense" (auto-complete) in VSCode for `nw`?
64+
65+
![Screenshot of VSCode Intellisense for NW.js](https://user-images.githubusercontent.com/4629794/59388510-ea981b00-8d39-11e9-8e18-bf3425901410.png)
66+
67+
1. Install nwjs-types
68+
```
69+
npm install --save-dev nwjs-types
70+
```
71+
1. Force VSCode's TypeScript engine to load.
72+
* Place `// @ts-check` at the top of your JS file.
73+
* You do not need to use TypeScript for this to work.
74+
* VSCode will load the TypeScript engine when it sees `// @ts-check`, then look for types in your `node_modules`, then find and load `nwjs-types`.
75+
* Then intellisense will know how to auto-complete for `nw.`.

0 commit comments

Comments
 (0)