window-resize-subject
Advanced tools
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var WindowResizeSubject=function(){function e(e){var t=(void 0===e?{}:e).delay,i=void 0===t?50:t;this._observers=new Map,this._subscribed=!1,this._delay=i,this._handler=this._handleResize.bind(this)}return e.prototype.addObserver=function(e,t){return this._observers.set(e,t),this},e.prototype.deleteObserver=function(e){return this._observers.delete(e),this},e.prototype.deleteObservers=function(){return this._observers=new Map,this},e.prototype.notifyObservers=function(t){this._observers.forEach(function(e){e(t)})},e.prototype.subscribe=function(){return"undefined"==typeof window||this._subscribed||(this._update(),window.addEventListener("resize",this._handler),window.addEventListener("orientationchange",this._handler),this._subscribed=!0),this},e.prototype.unsubscribe=function(){return this._subscribed&&(window.removeEventListener("resize",this._handler),window.removeEventListener("orientationchange",this._handler),this._subscribed=!1),this},e.prototype.setDelay=function(e){this._delay=e},e.prototype._update=function(){this.notifyObservers({width:window.innerWidth,height:window.innerHeight})},e.prototype._handleResize=function(){var e=this;clearTimeout(this._timer),this._timer=setTimeout(function(){e._update()},this._delay)},e}();exports.WindowResizeSubject=WindowResizeSubject; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var WindowResizeSubject=function(){function e(e){var t=(void 0===e?{}:e).delay,i=void 0===t?33:t;this._observers=new Map,this._subscribed=!1,this._delay=i,this._handler=this._handleResize.bind(this)}return e.prototype.addObserver=function(e,t){return this._observers.set(e,t),this},e.prototype.deleteObserver=function(e){return this._observers.delete(e),this},e.prototype.deleteObservers=function(){return this._observers=new Map,this},e.prototype.notifyObservers=function(t){this._observers.forEach(function(e){e(t)})},e.prototype.subscribe=function(){return"undefined"==typeof window||this._subscribed||(this._update(),window.addEventListener("resize",this._handler),window.addEventListener("orientationchange",this._handler),this._subscribed=!0),this},e.prototype.unsubscribe=function(){return this._subscribed&&(window.removeEventListener("resize",this._handler),window.removeEventListener("orientationchange",this._handler),this._subscribed=!1),this},e.prototype.setDelay=function(e){this._delay=e},e.prototype._update=function(){this.notifyObservers({width:window.innerWidth,height:window.innerHeight})},e.prototype._handleResize=function(){var e=this;clearTimeout(this._timer),this._timer=setTimeout(function(){e._update()},this._delay)},e}();exports.WindowResizeSubject=WindowResizeSubject; |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).bundle=e.bundle||{},e.bundle.umd=e.bundle.umd||{},e.bundle.umd.js={}))}(this,function(e){"use strict";var t=(i.prototype.addObserver=function(e,t){return this._observers.set(e,t),this},i.prototype.deleteObserver=function(e){return this._observers.delete(e),this},i.prototype.deleteObservers=function(){return this._observers=new Map,this},i.prototype.notifyObservers=function(t){this._observers.forEach(function(e){e(t)})},i.prototype.subscribe=function(){return"undefined"==typeof window||this._subscribed||(this._update(),window.addEventListener("resize",this._handler),window.addEventListener("orientationchange",this._handler),this._subscribed=!0),this},i.prototype.unsubscribe=function(){return this._subscribed&&(window.removeEventListener("resize",this._handler),window.removeEventListener("orientationchange",this._handler),this._subscribed=!1),this},i.prototype.setDelay=function(e){this._delay=e},i.prototype._update=function(){this.notifyObservers({width:window.innerWidth,height:window.innerHeight})},i.prototype._handleResize=function(){var e=this;clearTimeout(this._timer),this._timer=setTimeout(function(){e._update()},this._delay)},i);function i(e){var t=(void 0===e?{}:e).delay,i=void 0===t?50:t;this._observers=new Map,this._subscribed=!1,this._delay=i,this._handler=this._handleResize.bind(this)}e.WindowResizeSubject=t,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).bundle=e.bundle||{},e.bundle.umd=e.bundle.umd||{},e.bundle.umd.js={}))}(this,function(e){"use strict";var t=(i.prototype.addObserver=function(e,t){return this._observers.set(e,t),this},i.prototype.deleteObserver=function(e){return this._observers.delete(e),this},i.prototype.deleteObservers=function(){return this._observers=new Map,this},i.prototype.notifyObservers=function(t){this._observers.forEach(function(e){e(t)})},i.prototype.subscribe=function(){return"undefined"==typeof window||this._subscribed||(this._update(),window.addEventListener("resize",this._handler),window.addEventListener("orientationchange",this._handler),this._subscribed=!0),this},i.prototype.unsubscribe=function(){return this._subscribed&&(window.removeEventListener("resize",this._handler),window.removeEventListener("orientationchange",this._handler),this._subscribed=!1),this},i.prototype.setDelay=function(e){this._delay=e},i.prototype._update=function(){this.notifyObservers({width:window.innerWidth,height:window.innerHeight})},i.prototype._handleResize=function(){var e=this;clearTimeout(this._timer),this._timer=setTimeout(function(){e._update()},this._delay)},i);function i(e){var t=(void 0===e?{}:e).delay,i=void 0===t?33:t;this._observers=new Map,this._subscribed=!1,this._delay=i,this._handler=this._handleResize.bind(this)}e.WindowResizeSubject=t,Object.defineProperty(e,"__esModule",{value:!0})}); |
{ | ||
"name": "window-resize-subject", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"main": "dist/index.common.js", | ||
@@ -5,0 +5,0 @@ "unpkg": "dist/index.umd.js", |
@@ -122,3 +122,3 @@ # window-resize-subject | ||
- type: `number` | ||
- default: `50` | ||
- default: `33` | ||
@@ -125,0 +125,0 @@ Changes the delay time for a resize event. |