Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@odopod/odo-window-events

Package Overview
Dependencies
Maintainers
3
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@odopod/odo-window-events - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

index.d.ts

18

dist/odo-window-events.esm.js

@@ -86,2 +86,12 @@ var throttleit = throttle;

debounced.flush = function () {
if (timeout) {
result = func.apply(context, args);
context = args = null;
clearTimeout(timeout);
timeout = null;
}
};
return debounced;

@@ -166,3 +176,3 @@ };

* Bind a callback to window scroll.
* @param {function} fn Callback to execute on scroll.
* @param {function(number, number):void} fn Callback to execute on scroll.
* @return {string} id of event, to be used with service's remove method.

@@ -177,3 +187,3 @@ */

* Bind a callback to window scroll which executes quicker.
* @param {function} fn Callback to execute on scroll.
* @param {function(number, number):void} fn Callback to execute on scroll.
* @return {string} id of event, to be used with service's remove method.

@@ -188,3 +198,3 @@ */

* Bind a callback to window resize.
* @param {function} fn Callback to execute on resize.
* @param {function(number, number):void} fn Callback to execute on resize.
* @return {string} id of event, to be used with service's remove method.

@@ -199,3 +209,3 @@ */

* Bind a callback to window resize.
* @param {function} fn Callback to execute on resize.
* @param {function(number, number):void} fn Callback to execute on resize.
* @return {string} id of event, to be used with service's remove method.

@@ -202,0 +212,0 @@ */

@@ -92,2 +92,12 @@ (function (global, factory) {

debounced.flush = function () {
if (timeout) {
result = func.apply(context, args);
context = args = null;
clearTimeout(timeout);
timeout = null;
}
};
return debounced;

@@ -172,3 +182,3 @@ };

* Bind a callback to window scroll.
* @param {function} fn Callback to execute on scroll.
* @param {function(number, number):void} fn Callback to execute on scroll.
* @return {string} id of event, to be used with service's remove method.

@@ -183,3 +193,3 @@ */

* Bind a callback to window scroll which executes quicker.
* @param {function} fn Callback to execute on scroll.
* @param {function(number, number):void} fn Callback to execute on scroll.
* @return {string} id of event, to be used with service's remove method.

@@ -194,3 +204,3 @@ */

* Bind a callback to window resize.
* @param {function} fn Callback to execute on resize.
* @param {function(number, number):void} fn Callback to execute on resize.
* @return {string} id of event, to be used with service's remove method.

@@ -205,3 +215,3 @@ */

* Bind a callback to window resize.
* @param {function} fn Callback to execute on resize.
* @param {function(number, number):void} fn Callback to execute on resize.
* @return {string} id of event, to be used with service's remove method.

@@ -208,0 +218,0 @@ */

@@ -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";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});
!function(l,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):l.OdoWindowEvents=e()}(this,function(){"use strict";var l=function(l,e){var n,a,t,i,c=0;return function(){n=this,a=arguments;var l=new Date-c;return i||(l>=e?o():i=setTimeout(o,e-l)),t};function o(){i=0,c=+new Date,t=l.apply(n,a),n=null,a=null}};var e=function(l,e,n){var a,t,i,c,o;function r(){var s=Date.now()-c;s<e&&s>=0?a=setTimeout(r,e-s):(a=null,n||(o=l.apply(i,t),i=t=null))}null==e&&(e=100);var s=function(){i=this,t=arguments,c=Date.now();var s=n&&!a;return a||(a=setTimeout(r,e)),s&&(o=l.apply(i,t),i=t=null),o};return s.clear=function(){a&&(clearTimeout(a),a=null)},s.flush=function(){a&&(o=l.apply(i,t),i=t=null,clearTimeout(a),a=null)},s},n=0;function a(l,e){Object.keys(l).forEach(function(n){l[n].call(null,e[0],e[1])})}function t(){return{top:window.pageYOffset,left:window.pageXOffset}}function i(){return{width:window.innerWidth,height:window.innerHeight}}function c(l,e){var a="OdoWindowEvents"+(n+=1);return l[a]=e,a}var o={_scrollCallbacks:{},_fastScrollCallbacks:{},_resizeCallbacks:{},_leadingResizeCallbacks:{},_callbacks:{resize:function(){var l=i();a(o._resizeCallbacks,[l.width,l.height])},leadingResize:function(){var l=i();a(o._leadingResizeCallbacks,[l.width,l.height])},scroll:function(){var l=t();a(o._scrollCallbacks,[l.top,l.left])},fastScroll:function(){var l=t();a(o._fastScrollCallbacks,[l.top,l.left])}},Timing:{DEBOUNCE_TIME:500,THROTTLE_TIME_DEFAULT:500,THROTTLE_TIME_FAST:150},onScroll:function(l){return c(o._scrollCallbacks,l)},onFastScroll:function(l){return c(o._fastScrollCallbacks,l)},onResize:function(l){return c(o._resizeCallbacks,l)},onLeadingResize:function(l){return c(o._leadingResizeCallbacks,l)},remove:function(l){delete o._scrollCallbacks[l],delete o._fastScrollCallbacks[l],delete o._resizeCallbacks[l],delete o._leadingResizeCallbacks[l]}},r=e(o._callbacks.resize,o.Timing.DEBOUNCE_TIME),s=e(o._callbacks.leadingResize,o.Timing.DEBOUNCE_TIME,!0),u=l(o._callbacks.scroll,o.Timing.THROTTLE_TIME_DEFAULT),f=l(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.1.0",
"version": "1.2.0",
"main": "dist/odo-window-events.js",
"module": "dist/odo-window-events.esm.js",
"odoModule": "src/window-events.js",
"types": "index.d.ts",
"sideEffects": false,

@@ -28,3 +29,4 @@ "author": "Odopod",

"dist",
"src"
"src",
"index.d.ts"
],

@@ -31,0 +33,0 @@ "odoKeywords": [

@@ -83,3 +83,3 @@ import throttle from 'throttleit';

* Bind a callback to window scroll.
* @param {function} fn Callback to execute on scroll.
* @param {function(number, number):void} fn Callback to execute on scroll.
* @return {string} id of event, to be used with service's remove method.

@@ -93,3 +93,3 @@ */

* Bind a callback to window scroll which executes quicker.
* @param {function} fn Callback to execute on scroll.
* @param {function(number, number):void} fn Callback to execute on scroll.
* @return {string} id of event, to be used with service's remove method.

@@ -103,3 +103,3 @@ */

* Bind a callback to window resize.
* @param {function} fn Callback to execute on resize.
* @param {function(number, number):void} fn Callback to execute on resize.
* @return {string} id of event, to be used with service's remove method.

@@ -113,3 +113,3 @@ */

* Bind a callback to window resize.
* @param {function} fn Callback to execute on resize.
* @param {function(number, number):void} fn Callback to execute on resize.
* @return {string} id of event, to be used with service's remove method.

@@ -116,0 +116,0 @@ */

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc