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

Function destroy

src/instance/methods/destroy.js:4–32  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2import { applyStyle } from '../functions/style'
3
4export default function destroy() {
5 /**
6 * Remove all generated styles and element ids
7 */
8 each(this.store.elements, element => {
9 applyStyle(element.node, element.styles.inline.generated)
10 element.node.removeAttribute('data-sr-id')
11 })
12
13 /**
14 * Remove all event listeners.
15 */
16 each(this.store.containers, container => {
17 const target =
18 container.node === document.documentElement ? window : container.node
19 target.removeEventListener('scroll', this.delegate)
20 target.removeEventListener('resize', this.delegate)
21 })
22
23 /**
24 * Clear all data from the store
25 */
26 this.store = {
27 containers: {},
28 elements: {},
29 history: [],
30 sequences: {}
31 }
32}

Callers

nothing calls this directly

Calls 2

applyStyleFunction · 0.90
eachFunction · 0.85

Tested by

no test coverage detected