3 ms·
I had a couple of constraints which made me go with a tool like Pubnub. 1. I wanted to release this to the public. 2. I wanted to have the option of adding su
by saimiam 8y ago
I had a couple of constraints which made me go with a tool like Pubnub.
1. I wanted to release this to the public.
2. I wanted to have the option of adding support for future socialmedia referrers without releasing new code.
To solve for 2, I chose to create a central server which pushes out up-to-date styling instructions on request. The alternative would have been to create a static css file which runs into issues of caching.
To solve for 1, I chose messaging (PubNub) instead of http to (a) avoid dealing with CORS because I wasn't sure I'd get it right because my infra is selfhosted (b) learn and use messaging in a live app.
> window.performance
That flag is to check if a page is being reloaded or not. Since the referrer http header (from where javascript presumably gets its value) persists across reloads, to keep track of true referrals vs reloads, I check for the value of this flag.