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.0.0 to 3.1.0

16

index.js

@@ -11,3 +11,3 @@ /* global MutationObserver */

var observer = new MutationObserver(function (mutations) {
if (watch.length < 1) return
if (Object.keys(watch).length < 1) return
for (var i = 0; i < mutations.length; i++) {

@@ -40,5 +40,5 @@ if (mutations[i].attributeName === KEY_ATTR) {

function turnon (index) {
function turnon (index, el) {
if (watch[index][0] && watch[index][2] === 0) {
watch[index][0]()
watch[index][0](el)
watch[index][2] = 1

@@ -48,5 +48,5 @@ }

function turnoff (index) {
function turnoff (index, el) {
if (watch[index][1] && watch[index][2] === 1) {
watch[index][1]()
watch[index][1](el)
watch[index][2] = 0

@@ -67,6 +67,6 @@ }

if (mutation.oldValue === k) {
off(k)
off(k, mutation.target)
}
if (newValue === k) {
on(k)
on(k, mutation.target)
}

@@ -87,3 +87,3 @@ })

if (onloadid === k) {
fn(k)
fn(k, nodes[i])
}

@@ -90,0 +90,0 @@ })

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

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

@@ -16,5 +16,5 @@ # on-load

var div = document.createElement('div')
onload(div, function () {
onload(div, function (el) {
console.log('in the dom')
}, function () {
}, function (el) {
console.log('out of the dom')

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