Skip to content

Commit

Permalink
Merge pull request #55 from AddSearch/sc-8498/reference-error-document
Browse files Browse the repository at this point in the history
[sc-8498] check typeof document
  • Loading branch information
haoAddsearch authored Aug 25, 2023
2 parents 0de646f + 57ea131 commit 4b31ba5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion dist/addsearch-js-client.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "addsearch-js-client",
"version": "0.8.6",
"version": "0.8.7",
"description": "AddSearch API JavaScript client",
"main": "index.js",
"jsdelivr": "./dist/addsearch-js-client.min.js",
Expand Down
6 changes: 3 additions & 3 deletions src/cookie.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const setCookie = function(cookieName, cookieValue, expireDays) {
if (!document) {
if (typeof document === 'undefined') {
return;
}
const date = new Date();
Expand All @@ -9,7 +9,7 @@ const setCookie = function(cookieName, cookieValue, expireDays) {
}

const getCookie = function(cookieName) {
if (!document) {
if (typeof document === 'undefined') {
return;
}
let name = cookieName + "=";
Expand All @@ -28,7 +28,7 @@ const getCookie = function(cookieName) {
}

const deleteCookie = function(name) {
if (!document) {
if (typeof document === 'undefined') {
return;
}
document.cookie = name +'=; Path=/; Expires=Thu, 01 Jan 2000 00:00:01 GMT;';
Expand Down

0 comments on commit 4b31ba5

Please sign in to comment.