Comparing version 0.1.0 to 0.1.1
@@ -60,5 +60,7 @@ (function (global, factory) { | ||
function toggleEventListeners(handler, container, add) { | ||
var method = add ? 'addEventListener' : 'removeEventListener'; | ||
win[method]('resize', handler); | ||
container[method]('scroll', handler); | ||
if (win) { | ||
var method = add ? 'addEventListener' : 'removeEventListener'; | ||
win[method]('resize', handler); | ||
container[method]('scroll', handler); | ||
} | ||
} | ||
@@ -82,2 +84,3 @@ | ||
} | ||
return this; | ||
}; | ||
@@ -84,0 +87,0 @@ |
@@ -18,5 +18,7 @@ const win = typeof window !== 'undefined' && window | ||
function toggleEventListeners (handler, container, add) { | ||
const method = add ? 'addEventListener' : 'removeEventListener' | ||
win[method]('resize', handler) | ||
container[method]('scroll', handler) | ||
if (win) { | ||
const method = add ? 'addEventListener' : 'removeEventListener' | ||
win[method]('resize', handler) | ||
container[method]('scroll', handler) | ||
} | ||
} | ||
@@ -37,2 +39,3 @@ | ||
} | ||
return this | ||
} | ||
@@ -39,0 +42,0 @@ |
{ | ||
"name": "viewprt", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "viewport observation tool", | ||
@@ -5,0 +5,0 @@ "author": "Garth Poitras <garth22@gmail.com>", |
@@ -31,2 +31,7 @@ import assert from 'assert' | ||
}) | ||
it('returns instance when calling start()', () => { | ||
let obsrvr = new ViewportObserver().start() | ||
assert.ok(obsrvr instanceof ViewportObserver) | ||
}) | ||
}) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16314
323