Skip to content

Commit

Permalink
兼容在 Node 端引入模块
Browse files Browse the repository at this point in the history
  • Loading branch information
heeroluo committed Apr 26, 2019
1 parent 35c2aff commit a8f183a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/cookie/1.1/cookie.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ var get = exports.get = function(key, options) {

// iOS9下设置过期不会马上生效,先设为空
var shouldSetEmptyBeforeRemove = (function() {
// 兼容 Node 端(主要针对同构应用)引入
if (typeof document === 'undefined') { return false; }

var TEST_KEY = '__jraiser__test__cookie__';
document.cookie = TEST_KEY + '=1';
document.cookie = TEST_KEY + '=;expires=Thu, 01 Jan 1970 00:00:00 GMT';
Expand Down

0 comments on commit a8f183a

Please sign in to comment.