New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

onscrolling

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

onscrolling - npm Package Compare versions

Comparing version 0.3.2 to 0.3.3

1

bower.json
{
"name": "onscrolling",
"version": "0.3.0",
"homepage": "https://github.com/acusti/onscrolling",

@@ -5,0 +4,0 @@ "authors": [

6

package.json
{
"name": "onscrolling",
"version": "0.3.2",
"version": "0.3.3",
"description": "A better, smoother, more performant window.onscroll event interface using requestAnimationFrame for performance and mobile-compatibility",

@@ -38,4 +38,4 @@ "main": "dist/onscrolling.js",

"mocha": "^2.2.1",
"mocha-phantomjs": "^3.5.3",
"phantomjs": "^1.9.16",
"mocha-phantomjs": "^4.0.2",
"phantomjs": "1.9.15",
"should": "^5.2.0",

@@ -42,0 +42,0 @@ "sinon": "^1.14.1"

@@ -11,3 +11,3 @@ # Jank-free onscrolling  [![Build Status](https://travis-ci.org/acusti/onscrolling.svg?branch=master)](https://travis-ci.org/acusti/onscrolling)

### `onscrolling( callback )`
### onscrolling( callback )

@@ -18,3 +18,3 @@ #### `callback` function

### `onscrolling( direction, callback )`
### onscrolling( direction, callback )

@@ -29,3 +29,3 @@ #### `direction` string

### `onscrolling.remove( fn )`
### onscrolling.remove( fn )

@@ -36,3 +36,3 @@ #### `fn` function

### `onscrolling( direction, fn )`
### onscrolling.remove( direction, fn )

@@ -57,3 +57,3 @@ #### `direction` string

Tests use Mocha + Should.js + Sinon and must be run in a browser. Just open `test/index.html` in a browser (should even work using the `file://` protocol).
Tests use Mocha + Should.js + Sinon. Using `npm test` will run the tests in PhantomJS, but you can also open `test/index.html` directly in a browser.

@@ -63,6 +63,7 @@ ## TODO

- [ ] Add optional param to specify an object other than `window` to monitor for scroll events
- [ ] Expose `measure` and `mutate` functions to attach handlers specifically to the measuring (read) or mutating (write) portion of each cycle to minimize layout calculations
## Misc
*Note: This is the package formerly known as [jank-free-onscroll][]*
*Note: This package was formerly known as [jank-free-onscroll][]*

@@ -69,0 +70,0 @@

@@ -18,13 +18,13 @@ 'use strict';

// Module state
var isSupported = !!requestFrame,
isListening = false,
isQueued = false,
isIdle = true,
scrollY = window.pageYOffset,
scrollX = window.pageXOffset,
scrollYCached = scrollY,
scrollXCached = scrollX,
directionX = ['x', 'horizontal'],
directionAll = ['any'],
callbackQueue = {
var isSupported = !!requestFrame,
isListening = false,
isQueued = false,
isIdle = true,
scrollY = window.pageYOffset,
scrollX = window.pageXOffset,
scrollYCached = scrollY,
scrollXCached = scrollX,
directionX = ['x', 'horizontal'],
directionAll = ['any'],
callbackQueue = {
x : [],

@@ -48,3 +48,3 @@ y : [],

if (scrollY !== scrollYCached) {
if (scrollY !== scrollYCached) {
callbackQueue.y.forEach(triggerCallback.y);

@@ -54,3 +54,3 @@ scrollYCached = scrollY;

}
if (scrollX !== scrollXCached) {
if (scrollX !== scrollXCached) {
callbackQueue.x.forEach(triggerCallback.x);

@@ -109,3 +109,3 @@ scrollXCached = scrollX;

isIdle = false;
requestTick();
requestTick();
disableScrollListener();

@@ -115,5 +115,5 @@ }

function requestTick() {
if (isQueued) {
if (isQueued) {
return;
}
}
if (!detectIdleTimeout) {

@@ -123,12 +123,12 @@ // Idle is defined as 1.5 seconds without scroll change

}
tickId = requestFrame(handleScroll);
isQueued = true;
tickId = requestFrame(handleScroll);
isQueued = true;
}
function cancelTick() {
if (!isQueued) {
if (!isQueued) {
return;
}
cancelFrame(tickId);
isQueued = false;
}
cancelFrame(tickId);
isQueued = false;
}

@@ -154,6 +154,6 @@

function onscrolling(direction, callback) {
if (!isSupported) {
return;
}
enableScrollListener();
if (!isSupported) {
return;
}
enableScrollListener();
// Verify parameters

@@ -160,0 +160,0 @@ if (typeof direction === 'function') {

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