-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add onFidesEvent method for an alternative way to subscribe to Fides events #5297
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Skipped Deployment
|
fides Run #10059
Run Properties:
|
Project |
fides
|
Branch Review |
refs/pull/5297/merge
|
Run status |
Passed #10059
|
Run duration | 00m 38s |
Commit |
bb3ca1465c ℹ️: Merge a2dace0e50eee92b7fa379d0a0214f5b51790c07 into b4e014f2001d57284659a686651e...
|
Committer | Guntars Ašmanis-Graham |
View all properties for this run ↗︎ |
Test results | |
---|---|
Failures |
0
|
Flaky |
0
|
Pending |
0
|
Skipped |
0
|
Passing |
4
|
Upgrade your plan to view test results. | |
View all changes introduced in this branch ↗︎ |
Btw, there's an issue with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small change request but nothing blocking. Manually tested this and was able to get the event details surfaced using the new onFidesEvent
method.
Thanks @guncha !
fides Run #10064
Run Properties:
|
Project |
fides
|
Branch Review |
main
|
Run status |
Passed #10064
|
Run duration | 00m 37s |
Commit |
5b706eae82: Add onFidesEvent method for an alternative way to subscribe to Fides events (#52...
|
Committer | Guntars Ašmanis-Graham |
View all properties for this run ↗︎ |
Test results | |
---|---|
Failures |
0
|
Flaky |
0
|
Pending |
0
|
Skipped |
0
|
Passing |
4
|
Upgrade your plan to view test results. | |
View all changes introduced in this branch ↗︎ |
Description Of Changes
This PR adds an
onFidesEvent
method to the globalFides
object that subscribes the callback to Fides events. This is equivalent to callingwindow.addEventListener(...)
yourself, except that the callback receives theFidesEventDetail
object instead of aCustomEvent
. This is needed for the Google Tag Manager template integration as it doesn't allow usage of APIs likeaddEventListener
and also doesn't supportCustomEvent
or, really, any other non-primitive type.See this Slack thread for the rationale.
Code Changes
onFidesEvent
method tofides.ts
andfides-tcf.ts
Steps to Confirm
fides.js
version on a pageFides.onFidesEvent
is availableconsole.log
), trigger the event and verify that the handler was calledPre-Merge Checklist
CHANGELOG.md