Skip to content

Commit

Permalink
Merge pull request #50 from serjek/patch-1
Browse files Browse the repository at this point in the history
Update Storage.ts
  • Loading branch information
endel committed Apr 24, 2019
2 parents f487809 + 1c2d392 commit 75f47e5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ function getStorage() {
if (!storage) {
storage = (typeof (cc) !== 'undefined' && cc.sys && cc.sys.localStorage)
? cc.sys.localStorage // compatibility with cocos creator
: typeof (window) !== "undefined"
: typeof (window) !== "undefined" && window.localStorage //RN does have window object at this point, but localStorage is not defined
? window.localStorage // regular browser environment
: { // mock localStorage for Node.js environment
: { // mock localStorage for Node.js or RN environment
cache: {},
setItem: function(key, value) { this.cache[key] = value; },
getItem: function(key) { this.cache[key]; },
Expand Down

0 comments on commit 75f47e5

Please sign in to comment.