Logo
    Search

    real-time updates

    Explore "real-time updates" with insightful episodes like "8 Tricks When Using the Fetch() API", "New Viewport Units", "Hasty Treat - Updating / Restarting Long-Running Web Apps" and "Thinking Ahead for Emergency UI When Building a Website" from podcasts like ""Syntax - Tasty Web Development Treats", "Syntax - Tasty Web Development Treats", "Syntax - Tasty Web Development Treats" and "Syntax - Tasty Web Development Treats"" and more!

    Episodes (4)

    8 Tricks When Using the Fetch() API

    8 Tricks When Using the Fetch() API

    In this Hasty Treat, Scott and Wes talk about 8 tricks to try when using the Fetch() API.

    Show Notes

    // Create a new TextDecoder instance const decoder = new TextDecoder();  // Make the fetch request fetch('https://api.example.com/streaming-data')   .then(response => {     // Check if the response is valid     if (!response.ok) {       throw new Error('Network response was not ok');     }      // Stream the response data using a TextDecoder     const reader = response.body.getReader();      // Function to read the streamed chunks     function read() {       return reader.read().then(({ done, value }) => {         // Check if the streaming is complete         if (done) {           console.log('Streaming complete');           return;         }          // Decode and process the streamed data         const decodedData = decoder.decode(value, { stream: true });         console.log(decodedData);          // Continue reading the next chunk         return read();       });     }      // Start reading the chunks     return read();   })   .catch(error => {     // Handle errors     console.log('Error:', error);   }); 
    // Create an AbortController instance const controller = new AbortController();  // Set a timeout to abort the request after 5 seconds const timeout = setTimeout(() => { controller.abort(); }, 5000);  // Fetch request with the AbortController fetch('https://api.example.com/data', { signal: controller.signal }) 
    • 11:32 4) Testing if JSON is returned
    • 13:18 5) async + await + catch

    const data = await fetch().catch(err => console.log(err));

    • 14:42 6) to awaited - return error and data at top level
    const [err, data] = collect(fetch()) if(err) // .... 
    const myRequest = new Request('https://traffic.libsyn.com/syntax/Syntax_-_641.mp3', {    headers: {       'Content-Type': 'text/plain',    } });  fetch(myRequest) 

    New Viewport Units

    New Viewport Units

    In this episode of Syntax, Wes and Scott talk about the new viewport units coming to the web - what are they and when can we use them?

    LogRocket - Sponsor

    LogRocket lets you replay what users do on your site, helping you reproduce bugs and fix issues faster. It’s an exception tracker, a session re-player and a performance monitor. Get 14 days free at logrocket.com/syntax.

    Sanity.io - Sponsor

    Sanity.io is a real-time headless CMS with a fully customizable Content Studio built in React. Get a Sanity powered site up and running in minutes at sanity.io/create. Get an awesome supercharged free developer plan on sanity.io/syntax.

    Show Notes

    Tweet us your tasty treats

    Hasty Treat - Updating / Restarting Long-Running Web Apps

    Hasty Treat - Updating / Restarting Long-Running Web Apps

    In this Hasty Treat, Scott and Wes talk about updating web apps that have running for a long time — the problems to look out for and how to avoid them.

    LogRocket - Sponsor

    LogRocket lets you replay what users do on your site, helping you reproduce bugs and fix issues faster. It’s an exception tracker, a session re-player and a performance monitor. Get 14 days free at logrocket.com/syntax.

    Show Notes

    01:54 - The problem

    • This only affects the client-side

    05:28 - What are some solutions:

    • Do nothing and hope the user refreshes.
    • Have a list of assets, or commit hashes. Poll the server periodically, and when there is a new version available:
      • Prompt the user to refresh
      • Just refresh the user (store current state in localstorage and restore)
    • Do a custom component, that checks the last time the user has refreshed (or if new version if available). When they click the link, render a regular instead of a pushstate link.
    • Use a service worker. They will emit an event when a new version is available. Use the above methods to refresh the user.
    • Hot code push.
      • Vuepress has “hot reloading” baked in.

    Links

    Tweet us your tasty treats!

    Thinking Ahead for Emergency UI When Building a Website

    Thinking Ahead for Emergency UI When Building a Website

    In this episode of Syntax, Scott and Wes talk about emergency UI when building a website. During an emergency, you need to relay information to your website visitors as quickly and efficiently as possible. How do you do that? What do you need in place on your website?

    Sanity - Sponsor

    Sanity.io is a real-time headless CMS with a fully customizable Content Studio built in React. Get a Sanity powered site up and running in minutes at sanity.io/create. Get an awesome supercharged free developer plan on sanity.io/syntax.

    Sentry - Sponsor

    If you want to know what’s happening with your errors, track them with Sentry. Sentry is open-source error tracking that helps developers monitor and fix crashes in real time. Cut your time on error resolution from five hours to five minutes. It works with any language and integrates with dozens of other services. Syntax listeners can get two months for free by visiting Sentry.io and using the coupon code “tastytreat”.

    Show Notes

    5:40 - Banners and popups

    • Interfere
    • Static
    • Dismissible
    • Cookie/localstorage
    • When that popup is updated, it should show again. Maybe use a hash of the content? Or length? Something that resets itself every time the content is updated.
    • Private client-side-only PWAs are hard

    14:35 - Good styling

    • What happens if they add an image?
    • Do they have access to the branded fonts and colors in their WYSIWYG?
    • Can you revoke 100px red Times New Roman?

    18:32 - Page alerts

    • Yellow, green, red
    • Alerts on existing pages

    21:08 - New pages

    • Is there a good template for new pages?
    • Can they easily set the slug?
    • Can they add it to the nav?

    23:52 - Google’s “Hours of Operation”

    25:43 - Other

    34:38 - Deployment

    • Detail how to deploy everything
    • It might have been years and the CSS will only compile on Node 6 and Gulp 3
    • Do any caches need clearing?
    • Does the CSS need to be cache busted?

    Links

    ××× SIIIIICK ××× PIIIICKS ×××

    Shameless Plugs

    Tweet us your tasty treats!