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

on-load

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

on-load - npm Package Compare versions

Comparing version 3.1.1 to 3.2.0

18

index.js

@@ -30,7 +30,7 @@ /* global MutationObserver */

module.exports = function onload (el, on, off) {
module.exports = function onload (el, on, off, caller) {
on = on || function () {}
off = off || function () {}
el.setAttribute(KEY_ATTR, 'o' + INDEX)
watch['o' + INDEX] = [on, off, 0, onload.caller]
watch['o' + INDEX] = [on, off, 0, caller || onload.caller]
INDEX += 1

@@ -60,10 +60,8 @@ return el

}
Object.keys(watch).forEach(function (k) {
if (mutation.oldValue === k) {
off(k, mutation.target)
}
if (newValue === k) {
on(k, mutation.target)
}
})
if (watch[mutation.oldValue]) {
off(mutation.oldValue, mutation.target)
}
if (watch[newValue]) {
on(newValue, mutation.target)
}
}

@@ -70,0 +68,0 @@

{
"name": "on-load",
"version": "3.1.1",
"version": "3.2.0",
"description": "On load/unload events for DOM elements using a MutationObserver",

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

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