element-resize-event
Advanced tools
Comparing version 2.0.6 to 2.0.7
21
index.js
@@ -41,5 +41,7 @@ var exports = function exports(element, fn) { | ||
var trigger = win.__resizeTrigger__ | ||
trigger.__resizeListeners__.forEach(function (fn) { | ||
fn.call(trigger, e) | ||
}) | ||
if(trigger !== undefined) { | ||
trigger.__resizeListeners__.forEach(function (fn) { | ||
fn.call(trigger, e) | ||
}) | ||
} | ||
}) | ||
@@ -80,2 +82,15 @@ } | ||
exports.unbind = function(element, fn){ | ||
var attachEvent = document.attachEvent; | ||
element.__resizeListeners__.splice(element.__resizeListeners__.indexOf(fn), 1); | ||
if (!element.__resizeListeners__.length) { | ||
if (attachEvent) { | ||
element.detachEvent('onresize', resizeListener); | ||
} else { | ||
element.__resizeTrigger__.contentDocument.defaultView.removeEventListener('resize', resizeListener); | ||
element.__resizeTrigger__ = !element.removeChild(element.__resizeTrigger__); | ||
} | ||
} | ||
} | ||
module.exports = (typeof window === 'undefined') ? exports : exports.bind(window) |
{ | ||
"name": "element-resize-event", | ||
"description": "Polyfill to make it easy to listen for element resize events", | ||
"version": "2.0.6", | ||
"version": "2.0.7", | ||
"author": "Kyle Mathews <mathews.kyle@gmail.com>", | ||
@@ -6,0 +6,0 @@ "bugs": { |
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
85550
186