Skip to content

Commit

Permalink
fix: ssr support
Browse files Browse the repository at this point in the history
  • Loading branch information
40818419 committed Mar 20, 2020
1 parent 54b583e commit fc238d2
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Expand Up @@ -3,4 +3,5 @@ node_modules
dist
lib
npm-debug.log
package-lock.json
package-lock.json
.idea
3 changes: 2 additions & 1 deletion src/util.js
@@ -1,6 +1,7 @@
import assign from 'assign-deep'

const inBrowser = typeof window !== 'undefined'
const inBrowser = typeof window !== 'undefined' && window !== null

export const hasIntersectionObserver = checkIntersectionObserver()

function checkIntersectionObserver () {
Expand Down
15 changes: 12 additions & 3 deletions vue-lazyload.esm.js
@@ -1,6 +1,6 @@
/*!
* Vue-Lazyload.js v1.3.3
* (c) 2019 Awe <hilongjw@gmail.com>
* (c) 2020 Awe <hilongjw@gmail.com>
* Released under the MIT License.
*/
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
Expand Down Expand Up @@ -269,7 +269,7 @@ function extend(target, obj) {
assignSymbols(target, obj);

for (var key in obj) {
if (key !== '__proto__' && hasOwn(obj, key)) {
if (isValidKey(key) && hasOwn(obj, key)) {
var val = obj[key];
if (isObject$1(val)) {
if (kindOf(target[key]) === 'undefined' && kindOf(val) === 'function') {
Expand Down Expand Up @@ -300,13 +300,22 @@ function hasOwn(obj, key) {
return Object.prototype.hasOwnProperty.call(obj, key);
}

/**
* Returns true if the given `key` is a valid key that can be used for assigning properties.
*/

function isValidKey(key) {
return key !== '__proto__' && key !== 'constructor' && key !== 'prototype';
}

/**
* Expose `assign`
*/

var assignDeep = assign;

var inBrowser = typeof window !== 'undefined';
var inBrowser = typeof window !== 'undefined' && window !== null;

var hasIntersectionObserver = checkIntersectionObserver();

function checkIntersectionObserver() {
Expand Down

0 comments on commit fc238d2

Please sign in to comment.