Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
miaulightouch committed Jul 26, 2018
2 parents 855a4bb + 05b0ceb commit eed5722
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ sudo: false
language: node_js

node_js:
- "4"
- "6"
- "8"
- "10"

install:
- make install
Expand Down
24 changes: 22 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,22 +70,42 @@ Here are some examples:
<img width="647" alt="screen shot 2017-08-08 at 12 53 38 pm" src="https://user-images.githubusercontent.com/71256/29091700-a62a6888-7c38-11e7-800b-db911291ca2b.png">
<img width="647" alt="screen shot 2017-08-08 at 12 53 25 pm" src="https://user-images.githubusercontent.com/71256/29091701-a62ea114-7c38-11e7-826a-2692bedca740.png">

#### Windows note
#### Windows command prompt notes

##### CMD

On Windows the environment variable is set using the `set` command.

```cmd
set DEBUG=*,-not_this
```

Note that PowerShell uses different syntax to set environment variables.
Example:

```cmd
set DEBUG=* & node app.js
```

##### PowerShell (VS Code default)

PowerShell uses different syntax to set environment variables.

```cmd
$env:DEBUG = "*,-not_this"
```

Example:

```cmd
$env:DEBUG='app';node app.js
```

Then, run the program to be debugged as usual.

npm script example:
```js
"windowsDebug": "@powershell -Command $env:DEBUG='*';node app.js",
```

## Namespace Colors

Expand Down
14 changes: 6 additions & 8 deletions src/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@ exports.formatArgs = formatArgs;
exports.save = save;
exports.load = load;
exports.useColors = useColors;
exports.storage = 'undefined' == typeof process
&& 'undefined' != typeof chrome
&& 'undefined' != typeof chrome.storage
? chrome.storage.local
: localstorage();
exports.storage = localstorage();

/**
* Colors.
Expand Down Expand Up @@ -130,7 +126,7 @@ function save(namespaces) {
if (null == namespaces) {
exports.storage.removeItem('debug');
} else {
exports.storage.debug = namespaces;
exports.storage.setItem('debug', namespaces);
}
} catch(e) {}
}
Expand All @@ -145,7 +141,7 @@ function save(namespaces) {
function load() {
var r;
try {
r = exports.storage.debug;
r = exports.storage.getItem('debug');
} catch(e) {}

// If debug isn't set in LS, and we're in Electron, try to load $DEBUG
Expand All @@ -169,7 +165,9 @@ function load() {

function localstorage() {
try {
return window.localStorage;
// TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
// The Browser also has localStorage in the global context.
return localStorage;
} catch (e) {}
}

Expand Down
3 changes: 2 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
* treat as a browser.
*/

if (typeof process === 'undefined' || process.type === 'renderer' || process.__nwjs) {

if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) {
module.exports = require('./browser.js');
} else {
module.exports = require('./node.js');
Expand Down

0 comments on commit eed5722

Please sign in to comment.