Skip to content

Add support for NodeList in register/unregister/reactivate#67

Merged
spaansba merged 7 commits intomainfrom
support-nodelist
Mar 24, 2026
Merged

Add support for NodeList in register/unregister/reactivate#67
spaansba merged 7 commits intomainfrom
support-nodelist

Conversation

@spaansba
Copy link
Owner

@spaansba spaansba commented Mar 17, 2026

Fixes #66

For backwards compatibility its still called element even though it now also accepts NodeList

  • Add NodeList support to element in ForesightManager.instance.register()
  • Add NodeList support to element in ForesightManager.instance.unregister()
  • Add NodeList support to element in ForesightManager.instance.reactivate()
  • Changed ForesightManager.instance.register() return type to ForesightRegisterResult | ForesightRegisterResult[] based on if element is a single element or a NodeList
  • callback in ForesightManager.instance.register() now has a ForesightElementData parameter so you know which element's callback is being activated and how
  • Exported ForesightCallback type since its now not empty

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Mar 17, 2026

Deploying foresightjs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 9869633
Status: ✅  Deploy successful!
Preview URL: https://2d0c562c.foresightjs.pages.dev
Branch Preview URL: https://support-nodelist.foresightjs.pages.dev

View logs

@spaansba
Copy link
Owner Author

@jlukic is this what you were looking for?

@spaansba spaansba marked this pull request as ready for review March 17, 2026 21:34
@jlukic
Copy link

jlukic commented Mar 23, 2026

Yes looks great, thanks for the addition

@spaansba spaansba merged commit 2871f16 into main Mar 24, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feat Request: Support NodeList for Register

2 participants