@odopod/odo-window-events
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -7,3 +7,3 @@ (function (global, factory) { | ||
var throttleit$1 = throttle; | ||
var throttleit = throttle; | ||
@@ -224,4 +224,4 @@ /** | ||
var leadingResize = debounce(WindowEvents._callbacks.leadingResize, WindowEvents.Timing.DEBOUNCE_TIME, true); | ||
var scrolled = throttleit$1(WindowEvents._callbacks.scroll, WindowEvents.Timing.THROTTLE_TIME_DEFAULT); | ||
var fastScroll = throttleit$1(WindowEvents._callbacks.fastScroll, WindowEvents.Timing.THROTTLE_TIME_FAST); | ||
var scrolled = throttleit(WindowEvents._callbacks.scroll, WindowEvents.Timing.THROTTLE_TIME_DEFAULT); | ||
var fastScroll = throttleit(WindowEvents._callbacks.fastScroll, WindowEvents.Timing.THROTTLE_TIME_FAST); | ||
@@ -228,0 +228,0 @@ WindowEvents._resizeCallback = function () { |
@@ -1,2 +0,2 @@ | ||
!function(e,l){"object"==typeof exports&&"undefined"!=typeof module?module.exports=l():"function"==typeof define&&define.amd?define(l):e.OdoWindowEvents=l()}(this,function(){"use strict";function e(){return"OdoWindowEvents"+(o+=1)}function l(e,l){Object.keys(e).forEach(function(n){e[n].call(null,l[0],l[1])})}function n(){return{top:window.pageYOffset,left:window.pageXOffset}}function t(){return{width:window.innerWidth,height:window.innerHeight}}function i(l,n){var t=e();return l[t]=n,t}var a=function(e,l){function n(){c=0,o=+new Date,a=e.apply(t,i),t=null,i=null}var t,i,a,c,o=0;return function(){t=this,i=arguments;var e=new Date-o;return c||(e>=l?n():c=setTimeout(n,l-e)),a}},c=function(e,l,n){function t(){var s=Date.now()-o;s<l&&s>=0?i=setTimeout(t,l-s):(i=null,n||(r=e.apply(c,a),c=a=null))}var i,a,c,o,r;null==l&&(l=100);var s=function(){c=this,a=arguments,o=Date.now();var s=n&&!i;return i||(i=setTimeout(t,l)),s&&(r=e.apply(c,a),c=a=null),r};return s.clear=function(){i&&(clearTimeout(i),i=null)},s},o=0,r={_scrollCallbacks:{},_fastScrollCallbacks:{},_resizeCallbacks:{},_leadingResizeCallbacks:{},_callbacks:{resize:function(){var e=t();l(r._resizeCallbacks,[e.width,e.height])},leadingResize:function(){var e=t();l(r._leadingResizeCallbacks,[e.width,e.height])},scroll:function(){var e=n();l(r._scrollCallbacks,[e.top,e.left])},fastScroll:function(){var e=n();l(r._fastScrollCallbacks,[e.top,e.left])}},Timing:{DEBOUNCE_TIME:500,THROTTLE_TIME_DEFAULT:500,THROTTLE_TIME_FAST:150},onScroll:function(e){return i(r._scrollCallbacks,e)},onFastScroll:function(e){return i(r._fastScrollCallbacks,e)},onResize:function(e){return i(r._resizeCallbacks,e)},onLeadingResize:function(e){return i(r._leadingResizeCallbacks,e)},remove:function(e){delete r._scrollCallbacks[e],delete r._fastScrollCallbacks[e],delete r._resizeCallbacks[e],delete r._leadingResizeCallbacks[e]}},s=c(r._callbacks.resize,r.Timing.DEBOUNCE_TIME),u=c(r._callbacks.leadingResize,r.Timing.DEBOUNCE_TIME,!0),f=a(r._callbacks.scroll,r.Timing.THROTTLE_TIME_DEFAULT),d=a(r._callbacks.fastScroll,r.Timing.THROTTLE_TIME_FAST);return r._resizeCallback=function(){u(),s()},r._scrollCallback=function(){f(),d()},window.addEventListener("resize",r._resizeCallback),window.addEventListener("scroll",r._scrollCallback),r}); | ||
!function(e,l){"object"==typeof exports&&"undefined"!=typeof module?module.exports=l():"function"==typeof define&&define.amd?define(l):e.OdoWindowEvents=l()}(this,function(){"use strict";var e=function(e,l){var n,a,t,i,c=0;return function(){n=this,a=arguments;var e=new Date-c;return i||(e>=l?o():i=setTimeout(o,l-e)),t};function o(){i=0,c=+new Date,t=e.apply(n,a),n=null,a=null}};var l=function(e,l,n){var a,t,i,c,o;function r(){var s=Date.now()-c;s<l&&s>=0?a=setTimeout(r,l-s):(a=null,n||(o=e.apply(i,t),i=t=null))}null==l&&(l=100);var s=function(){i=this,t=arguments,c=Date.now();var s=n&&!a;return a||(a=setTimeout(r,l)),s&&(o=e.apply(i,t),i=t=null),o};return s.clear=function(){a&&(clearTimeout(a),a=null)},s},n=0;function a(e,l){Object.keys(e).forEach(function(n){e[n].call(null,l[0],l[1])})}function t(){return{top:window.pageYOffset,left:window.pageXOffset}}function i(){return{width:window.innerWidth,height:window.innerHeight}}function c(e,l){var a="OdoWindowEvents"+(n+=1);return e[a]=l,a}var o={_scrollCallbacks:{},_fastScrollCallbacks:{},_resizeCallbacks:{},_leadingResizeCallbacks:{},_callbacks:{resize:function(){var e=i();a(o._resizeCallbacks,[e.width,e.height])},leadingResize:function(){var e=i();a(o._leadingResizeCallbacks,[e.width,e.height])},scroll:function(){var e=t();a(o._scrollCallbacks,[e.top,e.left])},fastScroll:function(){var e=t();a(o._fastScrollCallbacks,[e.top,e.left])}},Timing:{DEBOUNCE_TIME:500,THROTTLE_TIME_DEFAULT:500,THROTTLE_TIME_FAST:150},onScroll:function(e){return c(o._scrollCallbacks,e)},onFastScroll:function(e){return c(o._fastScrollCallbacks,e)},onResize:function(e){return c(o._resizeCallbacks,e)},onLeadingResize:function(e){return c(o._leadingResizeCallbacks,e)},remove:function(e){delete o._scrollCallbacks[e],delete o._fastScrollCallbacks[e],delete o._resizeCallbacks[e],delete o._leadingResizeCallbacks[e]}},r=l(o._callbacks.resize,o.Timing.DEBOUNCE_TIME),s=l(o._callbacks.leadingResize,o.Timing.DEBOUNCE_TIME,!0),u=e(o._callbacks.scroll,o.Timing.THROTTLE_TIME_DEFAULT),f=e(o._callbacks.fastScroll,o.Timing.THROTTLE_TIME_FAST);return o._resizeCallback=function(){s(),r()},o._scrollCallback=function(){u(),f()},window.addEventListener("resize",o._resizeCallback),window.addEventListener("scroll",o._scrollCallback),o}); | ||
//# sourceMappingURL=odo-window-events.min.js.map |
{ | ||
"name": "@odopod/odo-window-events", | ||
"description": "Reusable, throttled events on the window object.", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"main": "dist/odo-window-events.js", | ||
@@ -40,3 +40,3 @@ "odoModule": "src/window-events.js", | ||
"license": "MIT", | ||
"repository": "odopod/odo", | ||
"repository": "odopod/code-library", | ||
"scripts": { | ||
@@ -43,0 +43,0 @@ "test": "gulp code-quality test" |
@@ -25,2 +25,2 @@ # Odo Window Events | ||
[permalink]: https://code.odopod.com/odo-window-events/ | ||
[permalink]: http://code.odopod.com/odo-window-events/ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
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
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
34637