MCPcopy
hub / github.com/jlmakes/scrollreveal / clean

Function clean

src/instance/methods/clean.js:7–34  ·  view source on GitHub ↗
(target)

Source from the content-addressed store, hash-verified

5import { applyStyle } from '../functions/style'
6
7export default function clean(target) {
8 let dirty
9 try {
10 each($(target), node => {
11 const id = node.getAttribute('data-sr-id')
12 if (id !== null) {
13 dirty = true
14 const element = this.store.elements[id]
15 if (element.callbackTimer) {
16 window.clearTimeout(element.callbackTimer.clock)
17 }
18 applyStyle(element.node, element.styles.inline.generated)
19 node.removeAttribute('data-sr-id')
20 delete this.store.elements[id]
21 }
22 })
23 } catch (e) {
24 return logger.call(this, 'Clean failed.', e.message)
25 }
26
27 if (dirty) {
28 try {
29 rinse.call(this)
30 } catch (e) {
31 return logger.call(this, 'Clean failed.', e.message)
32 }
33 }
34}

Callers

nothing calls this directly

Calls 2

applyStyleFunction · 0.90
eachFunction · 0.85

Tested by

no test coverage detected