Skip to content
This repository has been archived by the owner on Dec 11, 2023. It is now read-only.

Commit

Permalink
Add some JSDoc comment blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
nicross committed Aug 21, 2019
1 parent a1bb009 commit 765e5d7
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/Lazily.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
/**
* A lazy loader for lazy folks.
*
* This library leverages a `MutationObserver` to detect when elements are added to the DOM.
* If the native `loading` attribute is supported, then it is applied.
* Otherwise an `IntersectionObserver` is used to load elements as needed.
*
* @version 1.0-beta
*/
const Lazily = (function IIFE(undefined) {
'use strict'

Expand Down Expand Up @@ -125,14 +134,29 @@ const Lazily = (function IIFE(undefined) {
})
}

/** @yields Lazily */
return {
/**
* Forces all observed elements to load.
* Has no effect on elements supporting the `loading` attribute.
*
* @alias Lazily.forceLoad()
* @returns Lazily - chainable `this`
*/
forceLoad: function () {
if (isSupported) {
forceLoad()
}

return this
},
/**
* Returns whether the minimum requirements are met.
* If it's supported, then it's running.
*
* @alias Lazily.isSupported()
* @returns boolean
*/
isSupported: function () {
return isSupported
},
Expand Down

0 comments on commit 765e5d7

Please sign in to comment.