Skip to content

Commit 4ea9522

Browse files
committed
Fixed MobxDebug on browsers where localStorage === null
1 parent ecfcb4b commit 4ea9522

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
<a name="1.8.0"></a>
2+
# 1.8.0 (2017-10-03)
3+
* Fixed MobxDebug on browsers where localStorage === null
4+
15
<a name="1.7.0"></a>
26
# 1.7.0 (2017-09-03)
37
* Fixed MobX dependency

lib/utils/mobx-angular-debug.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,14 @@ import { extras, spy, isObservableArray, isObservableObject } from 'mobx';
44

55
// function for turning debug on / off
66
export const mobxAngularDebug = (() => {
7-
if (typeof localStorage === 'undefined' || typeof console === 'undefined') {
7+
if (typeof localStorage === 'undefined' || typeof console === 'undefined' || typeof window === 'undefined') {
88
return;
99
}
10+
11+
if (!localStorage || !console || !window) {
12+
return;
13+
}
14+
1015
window['mobxAngularDebug'] = (value) => {
1116
if (value) localStorage['mobx-angular-debug'] = true;
1217
else delete localStorage['mobx-angular-debug'];

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mobx-angular",
3-
"version": "1.7.0",
3+
"version": "1.8.0",
44
"description": "Angular connector to MobX (2 and above)",
55
"jsnext:main": "dist/mobx-angular.js",
66
"module": "dist/mobx-angular.js",

0 commit comments

Comments
 (0)