| 1 |
import rafSchd from 'raf-schd'; |
| 2 |
import { throttle } from 'throttle-debounce'; |
| 3 |
|
| 4 |
const { GHOSTKIT } = window; |
| 5 |
const { events } = GHOSTKIT; |
| 6 |
|
| 7 |
events.trigger(document, 'init.gkt'); |
| 8 |
|
| 9 |
const initBlocksThrottled = throttle( |
| 10 |
200, |
| 11 |
rafSchd(() => { |
| 12 |
events.trigger(document, 'init.blocks.gkt'); |
| 13 |
}) |
| 14 |
); |
| 15 |
|
| 16 |
// Init blocks. |
| 17 |
new window.MutationObserver(initBlocksThrottled).observe( |
| 18 |
document.documentElement, |
| 19 |
{ |
| 20 |
childList: true, |
| 21 |
subtree: true, |
| 22 |
} |
| 23 |
); |
| 24 |
|