Skip to content

Watchers

import { forms, requests } from 'pagepal/watchers';
createPalCore({ plugins: [forms('#signup'), requests()] });
pal.use(forms('#late-form'));

Each function returns a watcher to pass to plugins or use(). createPal() turns the same watchers on through its options: the last column shows the option.

WatcherReactioncreatePal() option
forms(target, { cheer, wince, progress }?)wince + look, warm up, wink, cheerwatch
requests({ delay, filter, isError, progress, kinds }?)waiting, wince, progress ringrequests
scroll({ threshold }?)dizzyscroll
network()sad, then cheernetwork
darkMode({ detect }?)sleepydarkMode
idle({ timeout }?)dozingidle
password()shypassword
rageClicks({ clicks, within, radius }?)concernedfrustration
deadClicks({ timeout, ignore }?)confuseddeadClicks
avoidOverlaps({ selectors, focus }?)moves asideavoid
copy()winkcopy
welcomeBack({ after }?)cheerwelcomeBack
pageErrors()winceerrors

requests({ kinds: ['xhr'] }) limits it to one API: kinds accepts 'fetch' and 'xhr'.

On unless turned off: scroll, network, darkMode, idle, password, frustration, deadClicks, avoid, copy, welcomeBack.

Off unless turned on: watch (needs a target), requests, errors.

The pal in the corner is pagepal itself.