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

scrollfeatures

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

scrollfeatures - npm Package Compare versions

Comparing version 1.4.1 to 1.4.2

2

dist/scrollfeatures.min.js

@@ -1,1 +0,1 @@

!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.ScrollFeatures=t()}}(function(){return function t(e,n,i){function r(s,l){if(!n[s]){if(!e[s]){var c="function"==typeof require&&require;if(!l&&c)return c(s,!0);if(o)return o(s,!0);var a=new Error("Cannot find module '"+s+"'");throw a.code="MODULE_NOT_FOUND",a}var h=n[s]={exports:{}};e[s][0].call(h.exports,function(t){var n=e[s][1][t];return r(n?n:t)},h,h.exports,t,e,n,i)}return n[s].exports}for(var o="function"==typeof require&&require,s=0;s<i.length;s++)r(i[s]);return r}({1:[function(t,e,n){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t){for(var e in t)if(t.hasOwnProperty(e))return!1;return!0}Object.defineProperty(n,"__esModule",{value:!0});var o=function(){function t(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],n=e.target,r=e.currentTarget;i(this,t),this._eventMap={},this._destroyed=!1,this._target=n||this,this._currentTarget=r||this,this.on=this.bind=this.addEventListener=this.addListener,this.off=this.unbind=this.removeEventListener=this.removeListener,this.once=this.one=this.addListenerOnce,this.emit=this.trigger=this.dispatchEvent=this.dispatch}return t.prototype.addListener=function(t,e){var n=this.getListener(t);return n?-1===n.indexOf(e)&&n.push(e):this._eventMap[t]=[e],this},t.prototype.addListenerOnce=function(t,e){var n=this,i=function(r){e(r),n.off(t,i),e=null,i=null};return this.on(t,i)},t.prototype.removeListener=function(t,e){if(!e)return this.removeAllListener(t);var n=this.getListener(t);if(n){var i=n.indexOf(e);i>-1&&(n=n.splice(i,1),n.length||delete this._eventMap[t])}return this},t.prototype.removeAllListener=function(t){var e=this.getListener(t);return e&&(this._eventMap[t].length=0,delete this._eventMap[t]),this},t.prototype.hasListener=function(t){return null!==this.getListener(t)},t.prototype.hasListeners=function(){return null!==this._eventMap&&void 0!==this._eventMap&&!r(this._eventMap)},t.prototype.dispatch=function(t,e){var n=this.getListener(t);if(n){e=e||{},e.type=t,e.target=e.target||this._target,e.currentTarget=e.currentTarget||this._currentTarget;for(var i=-1;++i<n.length;)n[i](e)}return this},t.prototype.getListener=function(t){var e=this._eventMap?this._eventMap[t]:null;return e||null},t.prototype.destroy=function(){if(this._eventMap){for(var t in this._eventMap)this.removeAllListener(t);this._eventMap=null}return this._destroyed=!0,this},t}();n["default"]=o,e.exports=n["default"]},{}],2:[function(t,e){"use strict";e.exports=t("./dist/eventdispatcher")},{"./dist/eventdispatcher":1}],3:[function(t,e){"use strict";var n=/(auto|scroll)/,i=function(t){var e=window.getComputedStyle(t,null);return n.test(e.getPropertyValue("overflow")+e.getPropertyValue("overflow-y")+e.getPropertyValue("overflow-x"))};e.exports=i},{}],4:[function(t,e){"use strict";var n=t("./has-overflow"),i=function(t){if(!(t instanceof HTMLElement))return window;for(;t.parentNode;){if(t.parentNode===document.body)return window;if(n(t.parentNode))return t.parentNode;t=t.parentNode}return window};e.exports=i},{"./has-overflow":3}],5:[function(t,e,n){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!==("undefined"==typeof e?"undefined":l(e))&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+("undefined"==typeof e?"undefined":l(e)));t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};Object.defineProperty(n,"__esModule",{value:!0});var c=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),a=t("eventdispatcher"),h=i(a),u=t("./scroll-parent"),d=i(u),f=function(){window.requestAnimationFrame||(window.requestAnimationFrame=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame,window.cancelAnimationFrame=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.msCancelAnimationFrame)},p=function(t){function e(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(r(this,e),e.hasInstance(n)){var s;return s=e.getInstance(n),o(l,s)}var l=o(this,t.call(this,{target:n}));return l._scrollTarget=null,l._destroyed=!1,l._y=0,l._x=0,l._speedY=0,l._speedX=0,l._lastSpeed=0,l._lastDirectionY=e.direction.none,l._lastDirectionX=e.direction.none,l._stopFrames=3,l._currentStopFrames=0,l._firstRender=!0,l._directionY=e.direction.none,l._directionX=e.direction.none,l._scrolling=!1,l._canScrollY=!1,l._canScrollX=!1,n.scrollFeatures=l,l._scrollTarget=n,l.options=i,_.animationFrame&&f(),l.init(),l}return s(e,t),e.getInstance=function(t,n){return t.scrollFeatures?t.scrollFeatures:new e(t,n)},e.hasInstance=function(t){return"undefined"!=typeof t.scrollFeatures},e.getScrollParent=function(t){return d["default"](t)},c(e,null,[{key:"windowY",get:function(){return window.pageYOffset||window.y||0}},{key:"windowX",get:function(){return window.pageXOffset||window.scrollX||0}},{key:"documentHeight",get:function(){return Math.max(document.body.scrollHeight,document.body.offsetHeight,document.documentElement.clientHeight,document.documentElement.scrollHeight,document.documentElement.offsetHeight)}},{key:"documentWidth",get:function(){return Math.max(document.body.scrollWidth,document.body.offsetWidth,document.documentElement.clientWidth,document.documentElement.scrollWidth,document.documentElement.offsetWidth)}}]),e.prototype.init=function(){var t=this;if(this.getScrollPosition=this._scrollTarget===window?function(){return{y:e.windowY,x:e.windowX}}.bind(this):function(){return{y:this._scrollTarget.scrollTop,x:this._scrollTarget.scrollLeft}}.bind(this),this.onResize=function(){t.trigger(e.events.SCROLL_RESIZE)},this.onScroll=this.onScroll.bind(this),this.onNextFrame=this.onNextFrame.bind(this),this.updateScrollPosition(),this._scrollTarget!==window){var n=/(auto|scroll)/,i=window.getComputedStyle(this._scrollTarget,null);this._canScrollY=n.test(i.getPropertyValue("overflow-y")),this._canScrollX=n.test(i.getPropertyValue("overflow-x"))}else this._canScrollY=this.clientHeight<this.scrollHeight,this._canScrollX=this.clientWidth<this.scrollWidth;this._scrollTarget.addEventListener?(this._scrollTarget.addEventListener("scroll",this.onScroll,!1),this._scrollTarget.addEventListener("resize",this.onResize,!1)):this._scrollTarget.attachEvent&&(this._scrollTarget.attachEvent("scroll",this.onScroll),this._scrollTarget.attachEvent("resize",this.onResize))},e.prototype.destroy=function(){this._destroyed||(this._cancelNextFrame(),t.prototype.destroy.call(this),this._scrollTarget.addEventListener?(this._scrollTarget.removeEventListener("scroll",this.onScroll),this._scrollTarget.removeEventListener("resize",this.onResize)):this._scrollTarget.attachEvent&&(this._scrollTarget.detachEvent("scroll",this.onScroll),this._scrollTarget.detachEvent("resize",this.onResize)),this.onResize=null,this.onScroll=null,this.getScrollPosition=null,this.onNextFrame=null,delete this._scrollTarget.scrollFeatures,this._scrollTarget=null,this._destroyed=!0)},e.prototype.updateScrollPosition=function(){this._y=this.y,this._x=this.x},e.prototype.onScroll=function(){return this._currentStopFrames=0,this._firstRender&&(this._firstRender=!1,this.y>1||this.x>1)?(this.updateScrollPosition(),void this.trigger(e.events.SCROLL_PROGRESS)):void(this._scrolling||(this._scrolling=!0,this._lastDirectionY=e.direction.none,this._lastDirectionX=e.direction.none,this.trigger(e.events.SCROLL_START),_.animationFrame?this.nextFrameID=window.requestAnimationFrame(this.onNextFrame):this.onNextFrame()))},e.prototype.onNextFrame=function(){var t=this;this._speedY=this._y-this.y,this._speedX=this._x-this.x;var n=+this.speedY+ +this.speedX;return this._scrolling&&0===n&&this._currentStopFrames++>this._stopFrames?void this.onScrollStop():(this.updateScrollPosition(),this._lastDirectionY!==this.directionY&&this.trigger("scroll:"+(this.directionY===e.direction.down?"down":"up")),this._lastDirectionX!==this.directionX&&this.trigger("scroll:"+(this.directionX===e.direction.right?"right":"left")),this._lastDirectionY=this.directionY,this._lastDirectionX=this.directionX,this.trigger(e.events.SCROLL_PROGRESS),void(_.animationFrame?this.nextFrameID=window.requestAnimationFrame(this.onNextFrame):this._nextTimeout=setTimeout(function(){t.onNextFrame()},1e3/60)))},e.prototype.onScrollStop=function(){this._scrolling=!1,this.updateScrollPosition(),this.trigger(e.events.SCROLL_STOP),this._canScrollY&&(this.y<=0?this.trigger(e.events.SCROLL_MIN):this.y+this.clientHeight>=this.scrollHeight&&this.trigger(e.events.SCROLL_MAX)),this._canScrollX&&(this.x<=0?this.trigger(e.events.SCROLL_MIN):this.x+this.clientWidth>=this.scrollWidth&&this.trigger(e.events.SCROLL_MAX)),this._cancelNextFrame()},e.prototype._cancelNextFrame=function(){this._currentStopFrames=0,_.animationFrame?(window.cancelAnimationFrame(this.nextFrameID),this.nextFrameID=-1):clearTimeout(this._nextTimeout)},c(e,[{key:"destroyed",get:function(){return this._destroyed}},{key:"scrollPosition",get:function(){return this.getScrollPosition()}},{key:"directionY",get:function(){return!this._canScrollY||0===this.speedY&&!this._scrolling?this._directionY=e.direction.none:this.speedY>0?this._directionY=e.direction.up:this.speedY<0&&(this._directionY=e.direction.down),this._directionY}},{key:"directionX",get:function(){return!this._canScrollX||0===this.speedX&&!this._scrolling?this._directionX=e.direction.none:this.speedX>0?this._directionX=e.direction.left:this.speedX<0&&(this._directionX=e.direction.right),this._directionX}},{key:"scrollTarget",get:function(){return this._scrollTarget}},{key:"scrolling",get:function(){return this._scrolling}},{key:"speedY",get:function(){return this._speedY}},{key:"speedX",get:function(){return this._speedX}},{key:"canScrollY",get:function(){return this._canScrollY}},{key:"canScrollX",get:function(){return this._canScrollX}},{key:"y",get:function(){return this.scrollPosition.y}},{key:"x",get:function(){return this.scrollPosition.x}},{key:"clientHeight",get:function(){return this._scrollTarget===window?window.innerHeight:this._scrollTarget.clientHeight}},{key:"clientWidth",get:function(){return this._scrollTarget===window?window.innerWidth:this._scrollTarget.clientWidth}},{key:"scrollHeight",get:function(){return this._scrollTarget===window?e.documentHeight:this._scrollTarget.scrollHeight}},{key:"scrollWidth",get:function(){return this._scrollTarget===window?e.documentWidth:this._scrollTarget.scrollWidth}}]),e}(h["default"]);p.direction={up:-1,down:1,none:0,right:2,left:-2},p.events={SCROLL_PROGRESS:"scroll:progress",SCROLL_START:"scroll:start",SCROLL_STOP:"scroll:stop",SCROLL_DOWN:"scroll:down",SCROLL_UP:"scroll:up",SCROLL_MIN:"scroll:min",SCROLL_MAX:"scroll:max",SCROLL_RESIZE:"scroll:resize"},n["default"]=p;var g=null,_=function(){function t(){r(this,t)}return c(t,null,[{key:"animationFrame",get:function(){return null===g&&(g=!!(window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame)),g}}]),t}();e.exports=n["default"]},{"./scroll-parent":4,eventdispatcher:2}]},{},[5])(5)});
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.ScrollFeatures=t()}}(function(){return function t(e,i,n){function r(s,l){if(!i[s]){if(!e[s]){var c="function"==typeof require&&require;if(!l&&c)return c(s,!0);if(o)return o(s,!0);var a=new Error("Cannot find module '"+s+"'");throw a.code="MODULE_NOT_FOUND",a}var h=i[s]={exports:{}};e[s][0].call(h.exports,function(t){var i=e[s][1][t];return r(i?i:t)},h,h.exports,t,e,i,n)}return i[s].exports}for(var o="function"==typeof require&&require,s=0;s<n.length;s++)r(n[s]);return r}({1:[function(t,e,i){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t){for(var e in t)if(t.hasOwnProperty(e))return!1;return!0}Object.defineProperty(i,"__esModule",{value:!0});var o=function(){function t(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],i=e.target,r=e.currentTarget;n(this,t),this._eventMap={},this._destroyed=!1,this._target=i||this,this._currentTarget=r||this,this.on=this.bind=this.addEventListener=this.addListener,this.off=this.unbind=this.removeEventListener=this.removeListener,this.once=this.one=this.addListenerOnce,this.emit=this.trigger=this.dispatchEvent=this.dispatch}return t.prototype.addListener=function(t,e){var i=this.getListener(t);return i?-1===i.indexOf(e)&&i.push(e):this._eventMap[t]=[e],this},t.prototype.addListenerOnce=function(t,e){var i=this,n=function(r){e(r),i.off(t,n),e=null,n=null};return this.on(t,n)},t.prototype.removeListener=function(t,e){if(!e)return this.removeAllListener(t);var i=this.getListener(t);if(i){var n=i.indexOf(e);n>-1&&(i=i.splice(n,1),i.length||delete this._eventMap[t])}return this},t.prototype.removeAllListener=function(t){var e=this.getListener(t);return e&&(this._eventMap[t].length=0,delete this._eventMap[t]),this},t.prototype.hasListener=function(t){return null!==this.getListener(t)},t.prototype.hasListeners=function(){return null!==this._eventMap&&void 0!==this._eventMap&&!r(this._eventMap)},t.prototype.dispatch=function(t,e){var i=this.getListener(t);if(i){e=e||{},e.type=t,e.target=e.target||this._target,e.currentTarget=e.currentTarget||this._currentTarget;for(var n=-1;++n<i.length;)i[n](e)}return this},t.prototype.getListener=function(t){var e=this._eventMap?this._eventMap[t]:null;return e||null},t.prototype.destroy=function(){if(this._eventMap){for(var t in this._eventMap)this.removeAllListener(t);this._eventMap=null}return this._destroyed=!0,this},t}();i["default"]=o,e.exports=i["default"]},{}],2:[function(t,e){"use strict";e.exports=t("./dist/eventdispatcher")},{"./dist/eventdispatcher":1}],3:[function(t,e){"use strict";var i=/(auto|scroll)/,n=function(t){var e=window.getComputedStyle(t,null);return i.test(e.getPropertyValue("overflow")+e.getPropertyValue("overflow-y")+e.getPropertyValue("overflow-x"))};e.exports=n},{}],4:[function(t,e){"use strict";var i=t("./has-overflow"),n=function(t){if(!(t instanceof HTMLElement))return window;for(;t.parentNode;){if(t.parentNode===document.body)return window;if(i(t.parentNode))return t.parentNode;t=t.parentNode}return window};e.exports=n},{"./has-overflow":3}],5:[function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(i,"__esModule",{value:!0});var l=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),c=t("eventdispatcher"),a=n(c),h=t("./scroll-parent"),u=n(h),d=function(){window.requestAnimationFrame||(window.requestAnimationFrame=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame,window.cancelAnimationFrame=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.msCancelAnimationFrame)},f=function(t){function e(){var i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(r(this,e),e.hasInstance(i)){var s;return s=e.getInstance(i),o(l,s)}var l=o(this,t.call(this,{target:i}));return l._scrollTarget=null,l._destroyed=!1,l._y=0,l._x=0,l._speedY=0,l._speedX=0,l._lastSpeed=0,l._lastDirectionY=e.direction.none,l._lastDirectionX=e.direction.none,l._stopFrames=3,l._currentStopFrames=0,l._firstRender=!0,l._directionY=e.direction.none,l._directionX=e.direction.none,l._scrolling=!1,l._canScrollY=!1,l._canScrollX=!1,i.scrollFeatures=l,l._scrollTarget=i,l.options=n,p.animationFrame&&d(),l.init(),l}return s(e,t),e.getInstance=function(t,i){return t.scrollFeatures?t.scrollFeatures:new e(t,i)},e.hasInstance=function(t){return"undefined"!=typeof t.scrollFeatures},e.getScrollParent=function(t){return u["default"](t)},l(e,null,[{key:"windowY",get:function(){return window.pageYOffset||window.y||0}},{key:"windowX",get:function(){return window.pageXOffset||window.scrollX||0}},{key:"documentHeight",get:function(){return Math.max(document.body.scrollHeight,document.body.offsetHeight,document.documentElement.clientHeight,document.documentElement.scrollHeight,document.documentElement.offsetHeight)}},{key:"documentWidth",get:function(){return Math.max(document.body.scrollWidth,document.body.offsetWidth,document.documentElement.clientWidth,document.documentElement.scrollWidth,document.documentElement.offsetWidth)}}]),e.prototype.init=function(){var t=this;if(this.getScrollPosition=this._scrollTarget===window?function(){return{y:e.windowY,x:e.windowX}}.bind(this):function(){return{y:this._scrollTarget.scrollTop,x:this._scrollTarget.scrollLeft}}.bind(this),this.onResize=function(){t.trigger(e.events.SCROLL_RESIZE)},this.onScroll=this.onScroll.bind(this),this.onNextFrame=this.onNextFrame.bind(this),this.updateScrollPosition(),this._scrollTarget!==window){var i=/(auto|scroll)/,n=window.getComputedStyle(this._scrollTarget,null);this._canScrollY=i.test(n.getPropertyValue("overflow-y")),this._canScrollX=i.test(n.getPropertyValue("overflow-x"))}else this._canScrollY=this.clientHeight<this.scrollHeight,this._canScrollX=this.clientWidth<this.scrollWidth;this._scrollTarget.addEventListener?(this._scrollTarget.addEventListener("scroll",this.onScroll,!1),this._scrollTarget.addEventListener("resize",this.onResize,!1)):this._scrollTarget.attachEvent&&(this._scrollTarget.attachEvent("scroll",this.onScroll),this._scrollTarget.attachEvent("resize",this.onResize))},e.prototype.destroy=function(){this._destroyed||(this._cancelNextFrame(),t.prototype.destroy.call(this),this._scrollTarget.addEventListener?(this._scrollTarget.removeEventListener("scroll",this.onScroll),this._scrollTarget.removeEventListener("resize",this.onResize)):this._scrollTarget.attachEvent&&(this._scrollTarget.detachEvent("scroll",this.onScroll),this._scrollTarget.detachEvent("resize",this.onResize)),this.onResize=null,this.onScroll=null,this.getScrollPosition=null,this.onNextFrame=null,delete this._scrollTarget.scrollFeatures,this._scrollTarget=null,this._destroyed=!0)},e.prototype.updateScrollPosition=function(){this._y=this.y,this._x=this.x},e.prototype.onScroll=function(){return this._currentStopFrames=0,this._firstRender&&(this._firstRender=!1,this.y>1||this.x>1)?(this.updateScrollPosition(),void this.trigger(e.events.SCROLL_PROGRESS)):void(this._scrolling||(this._scrolling=!0,this._lastDirectionY=e.direction.none,this._lastDirectionX=e.direction.none,this.trigger(e.events.SCROLL_START),p.animationFrame?this.nextFrameID=window.requestAnimationFrame(this.onNextFrame):this.onNextFrame()))},e.prototype.onNextFrame=function(){var t=this;this._speedY=this._y-this.y,this._speedX=this._x-this.x;var i=+this.speedY+ +this.speedX;return this._scrolling&&0===i&&this._currentStopFrames++>this._stopFrames?void this.onScrollStop():(this.updateScrollPosition(),this._lastDirectionY!==this.directionY&&this.trigger("scroll:"+(this.directionY===e.direction.down?"down":"up")),this._lastDirectionX!==this.directionX&&this.trigger("scroll:"+(this.directionX===e.direction.right?"right":"left")),this._lastDirectionY=this.directionY,this._lastDirectionX=this.directionX,this.trigger(e.events.SCROLL_PROGRESS),void(p.animationFrame?this.nextFrameID=window.requestAnimationFrame(this.onNextFrame):this._nextTimeout=setTimeout(function(){t.onNextFrame()},1e3/60)))},e.prototype.onScrollStop=function(){this._scrolling=!1,this.updateScrollPosition(),this.trigger(e.events.SCROLL_STOP),this._canScrollY&&(this.y<=0?this.trigger(e.events.SCROLL_MIN):this.y+this.clientHeight>=this.scrollHeight&&this.trigger(e.events.SCROLL_MAX)),this._canScrollX&&(this.x<=0?this.trigger(e.events.SCROLL_MIN):this.x+this.clientWidth>=this.scrollWidth&&this.trigger(e.events.SCROLL_MAX)),this._cancelNextFrame()},e.prototype._cancelNextFrame=function(){this._currentStopFrames=0,p.animationFrame?(window.cancelAnimationFrame(this.nextFrameID),this.nextFrameID=-1):clearTimeout(this._nextTimeout)},l(e,[{key:"destroyed",get:function(){return this._destroyed}},{key:"scrollPosition",get:function(){return this.getScrollPosition()}},{key:"directionY",get:function(){return!this._canScrollY||0===this.speedY&&!this._scrolling?this._directionY=e.direction.none:this.speedY>0?this._directionY=e.direction.up:this.speedY<0&&(this._directionY=e.direction.down),this._directionY}},{key:"directionX",get:function(){return!this._canScrollX||0===this.speedX&&!this._scrolling?this._directionX=e.direction.none:this.speedX>0?this._directionX=e.direction.left:this.speedX<0&&(this._directionX=e.direction.right),this._directionX}},{key:"scrollTarget",get:function(){return this._scrollTarget}},{key:"scrolling",get:function(){return this._scrolling}},{key:"speedY",get:function(){return this._speedY}},{key:"speedX",get:function(){return this._speedX}},{key:"canScrollY",get:function(){return this._canScrollY}},{key:"canScrollX",get:function(){return this._canScrollX}},{key:"y",get:function(){return this.scrollPosition.y}},{key:"x",get:function(){return this.scrollPosition.x}},{key:"clientHeight",get:function(){return this._scrollTarget===window?window.innerHeight:this._scrollTarget.clientHeight}},{key:"clientWidth",get:function(){return this._scrollTarget===window?window.innerWidth:this._scrollTarget.clientWidth}},{key:"scrollHeight",get:function(){return this._scrollTarget===window?e.documentHeight:this._scrollTarget.scrollHeight}},{key:"scrollWidth",get:function(){return this._scrollTarget===window?e.documentWidth:this._scrollTarget.scrollWidth}}]),e}(a["default"]);f.direction={up:-1,down:1,none:0,right:2,left:-2},f.events={SCROLL_PROGRESS:"scroll:progress",SCROLL_START:"scroll:start",SCROLL_STOP:"scroll:stop",SCROLL_DOWN:"scroll:down",SCROLL_UP:"scroll:up",SCROLL_MIN:"scroll:min",SCROLL_MAX:"scroll:max",SCROLL_RESIZE:"scroll:resize"},i["default"]=f;var g=null,p=function(){function t(){r(this,t)}return l(t,null,[{key:"animationFrame",get:function(){return null===g&&(g=!!(window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame)),g}}]),t}();e.exports=i["default"]},{"./scroll-parent":4,eventdispatcher:2}]},{},[5])(5)});
{
"name": "scrollfeatures",
"version": "1.4.1",
"version": "1.4.2",
"description": "Performant Custom Scroll Features and Events",

@@ -49,7 +49,2 @@ "scripts": {

"homepage": "https://github.com/soenkekluth/scrollfeatures#readme",
"browserify": {
"transform": [
"babelify"
]
},
"dependencies": {

@@ -56,0 +51,0 @@ "eventdispatcher": "2.1.0"

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