on-load

WebJar for on-load

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

on-load
Last Version

Last Version

3.2.0
Release Date

Release Date

Type

Type

jar
Description

Description

on-load
WebJar for on-load
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/shama/on-load

Download on-load

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/on-load/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>on-load</artifactId>
    <version>3.2.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/on-load/
implementation 'org.webjars.npm:on-load:3.2.0'
// https://jarcasting.com/artifacts/org.webjars.npm/on-load/
implementation ("org.webjars.npm:on-load:3.2.0")
'org.webjars.npm:on-load:jar:3.2.0'
<dependency org="org.webjars.npm" name="on-load" rev="3.2.0">
  <artifact name="on-load" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='on-load', version='3.2.0')
)
libraryDependencies += "org.webjars.npm" % "on-load" % "3.2.0"
[org.webjars.npm/on-load "3.2.0"]

Dependencies

compile (1)

Group / Artifact Type Version
org.webjars.npm : global jar [4.3.0,5)

Project Modules

There are no modules declared in this project.

on-load

NPM version build status Downloads js-standard-style

On load/unload events for DOM elements using a MutationObserver

usage

var onload = require('on-load')

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

// Will fire the onload
document.body.appendChild(div)

// ... some time later

// Will fire the onunload
document.body.removeChild(div)

API

onload(node, onloadFn, onunloadFn, [caller])

Pass a dom node to onload to have a onloadFn function fire when the dom node is added to the document dom and a onunloadFn fire when the dom node is removed from the document dom. Optionally a caller ID can be set to associate the onload/onunload hooks with a particular instance of of a dom node. This is commonly used when 'componentizing' dom nodes.

license

(c) 2018 Kyle Robinson Young. MIT License

Versions

Version
3.2.0