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

scroll-syncer

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

scroll-syncer - npm Package Compare versions

Comparing version 1.0.1 to 1.1.0

37

index.common.js

@@ -1,21 +0,15 @@

// detect if user-agent support passive event binding
var supportPassive = false
if (window && window.addEventListener && Object.defineProperty) {
var options = Object.defineProperty({}, 'passive', {
get: function () { supportPassive = true }
})
window.addEventListener('_detectpassive', null, options)
}
var bindOptions = supportPassive
? { passive: true, capture: true }
: true
function ScrollSyncer (vertical, horizontal) {
this._vertical = vertical
this._horizontal = horizontal
function ScrollSyncer (vertical, horizontal, usePassive) {
this._from = null
this._to = []
this._bindOptions = usePassive
? { passive: true, capture: true }
: true
this._scrollHandler = this.sync.bind(this)
this._sync = (function (e) {
var target = e.target
this._to.forEach(function (el) {
if (vertical) el.scrollTop = target.scrollTop
if (horizontal) el.scrollLeft = target.scrollLeft
}, this)
}).bind(this)
}

@@ -26,4 +20,3 @@

this._from = target
this._from.addEventListener('scroll', this._scrollHandler, bindOptions)
this.sync()
this._from.addEventListener('scroll', this._sync, this._bindOptions)
}

@@ -34,3 +27,2 @@

this._to.push(target)
this.sync()
}

@@ -40,6 +32,3 @@

if (this._from) {
this._to.forEach(function (el) {
if (this._vertical) el.scrollTop = this._from.scrollTop
if (this._horizontal) el.scrollLeft = this._from.scrollLeft
}, this)
this._sync({ target: this._from })
}

@@ -46,0 +35,0 @@ }

{
"name": "scroll-syncer",
"version": "1.0.1",
"version": "1.1.0",
"description": "Synchronize scoll position among several elements",

@@ -5,0 +5,0 @@ "main": "index.common.js",

@@ -10,3 +10,4 @@ # Scroll Syncer

true, /* vertical scroll position */
true /* horizontal scroll position */
true, /* horizontal scroll position */
true /* use passive event binding */
)

@@ -13,0 +14,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