Skip to content
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 support for passing functions in mainWindowAccessors #183

Merged
merged 3 commits into from
May 24, 2022

Conversation

slawekkolodziej
Copy link
Contributor

I recently stumbled upon mainWindowAccessors. I thought it would be cool if this could forward function calls too.

The implementation appeared to be relatively easy - I just added callMethod inside worker-serialization.ts. I didn't find any downsides of my change yet, but I would like to see another opinion.

This change along with my other PR (#172) allowed me to integrate GTM Tag Assistant with Partytown inside Next.js app (#72).

partytown-gtm.mp4

What you see on the video above is Tag Assistant communicating with GTM running inside Partytown. It requires Tag Assistant Companion browser plugin. Change in Partytown is not enough to get this working. It also requires GTM-specific code that tunnels messages from worker back to the Tag Assistant Companion.

@vercel
Copy link

vercel bot commented May 20, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
partytown ✅ Ready (Inspect) Visit Preview May 20, 2022 at 10:32AM (UTC)

@nicolaturcato
Copy link

Looking forward for this fix. Thanks @slawekkolodziej

@slawekkolodziej slawekkolodziej changed the title Function serializer Add support for passing functions in mainWindowAccessors May 20, 2022
@adamdbradley adamdbradley merged commit e6260a0 into QwikDev:main May 24, 2022
@adamdbradley
Copy link
Contributor

Awesome work, thanks!

@slawekkolodziej slawekkolodziej deleted the function-serializer branch May 26, 2022 21:06
@Axeldeblen
Copy link

@slawekkolodziej nice one do you mind sharing the code related to - It also requires GTM-specific code that tunnels messages from worker back to the Tag Assistant Companion.

@slawekkolodziej
Copy link
Contributor Author

I posted some details in #72. I may create a react component with 'GTM snippet' and put it on npm for the ease of use, but I don't have time for that now.

@oxyc
Copy link

oxyc commented Jan 3, 2023

How can this be used to get Google Tag Assistant working? I feel like there's an undocumented step? Which function should be exposed in mainWindowAccessors?

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.

5 participants