# defer

Published articles for defer.

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## Defer in Swift explained with Code Examples

DevFeed: [Defer in Swift explained with Code Examples](<https://devfeed.tech/articles/defer-in-swift-explained-with-code-examples-11485.md>)

Original publisher: [Read original article](<https://www.avanderlee.com/swift/defer-usage-swift/>)

Author: Antoine van der Lee

Published: 2026-07-06T12:51:59Z

Content type: tutorial

Language: en

Sources: [SwiftLee](<https://devfeed.tech/sources/swiftlee.md>)

Topics: [Swift](<https://devfeed.tech/topics/swift.md>), [Code](<https://devfeed.tech/topics/code.md>), [async/await](<https://devfeed.tech/topics/async-await.md>), [Concurrency](<https://devfeed.tech/topics/concurrency.md>)

Tags: [code](<https://devfeed.tech/tags/code.md>), [concurrency](<https://devfeed.tech/tags/concurrency.md>), [defer](<https://devfeed.tech/tags/defer.md>), [examples](<https://devfeed.tech/tags/examples.md>), [leaving](<https://devfeed.tech/tags/leaving.md>), [scope](<https://devfeed.tech/tags/scope.md>), [swift](<https://devfeed.tech/tags/swift.md>)

### AI overview

This tutorial explains Swift's defer statement, which runs code when control leaves its scope. It covers reverse execution order for multiple defer statements, using defer for resource cleanup, and Swift 6.4 support for awaiting asynchronous cleanup in defer bodies.

### Source excerpt

Although the defer keyword was already introduced in Swift 2.0, it's still quite uncommon to use it in projects. Its usage can be hard to understand, but using it can improve your code a lot in some places. The most common use case seen around is opening and closing a context within a scope. Starting ... -> The post Defer in Swift explained with Code Examples appeared first on SwiftLee.

## How to implement an image gallery using Baseline features

DevFeed: [How to implement an image gallery using Baseline features](<https://devfeed.tech/articles/how-to-implement-an-image-gallery-using-baseline-features-4158.md>)

Original publisher: [Read original article](<https://web.dev/articles/baseline-in-action-image-gallery?hl=en>)

Author: Stacy Kvernmo Bluesky Homepage

Published: 2025-10-29T07:00:00Z

Content type: tutorial

Language: en

Sources: [web.dev: Articles](<https://devfeed.tech/sources/web-dev-articles.md>)

Topics: [Web platform](<https://devfeed.tech/topics/web-platform.md>), [HTML](<https://devfeed.tech/topics/html.md>), [browser](<https://devfeed.tech/topics/browser.md>), [Developer Tools](<https://devfeed.tech/topics/developer-tools.md>), [Usability](<https://devfeed.tech/topics/usability.md>)

Tags: [browser](<https://devfeed.tech/tags/browser.md>), [defer](<https://devfeed.tech/tags/defer.md>), [demo](<https://devfeed.tech/tags/demo.md>), [developer-tools](<https://devfeed.tech/tags/developer-tools.md>), [features](<https://devfeed.tech/tags/features.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [html](<https://devfeed.tech/tags/html.md>), [performance](<https://devfeed.tech/tags/performance.md>), [techniques](<https://devfeed.tech/tags/techniques.md>), [usability](<https://devfeed.tech/tags/usability.md>), [user-interface](<https://devfeed.tech/tags/user-interface.md>), [web](<https://devfeed.tech/tags/web.md>)

### AI overview

This tutorial demonstrates how to implement a web image gallery with Baseline features. It focuses on reducing performance costs from large image collections through HTML-based lazy loading, including images that are initially hidden in dialogs.

### Source excerpt

Image galleries are a common user interface pattern on the web. Learn how to create one using Baseline features.

## Progressively Render Media Applications with GraphQL @defer in Apollo GraphOS

DevFeed: [Progressively Render Media Applications with GraphQL @defer in Apollo GraphOS](<https://devfeed.tech/articles/render-frontends-faster-23497.md>)

Original publisher: [Read original article](<https://www.apollographql.com/blog/render-frontends-faster>)

Author: Daljit Summan

Published: 2023-07-14T10:58:08Z

Content type: tutorial

Language: en

Sources: [Apollo Blog](<https://devfeed.tech/sources/apollo-blog.md>)

Topics: [GraphOS](<https://devfeed.tech/topics/graphos.md>), [GraphQL](<https://devfeed.tech/topics/graphql.md>), [API](<https://devfeed.tech/topics/api.md>), [User Experience](<https://devfeed.tech/topics/user-experience.md>)

Tags: [api](<https://devfeed.tech/tags/api.md>), [defer](<https://devfeed.tech/tags/defer.md>), [graphos](<https://devfeed.tech/tags/graphos.md>), [graphql](<https://devfeed.tech/tags/graphql.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [streaming](<https://devfeed.tech/tags/streaming.md>), [user-experience](<https://devfeed.tech/tags/user-experience.md>)

### AI overview

This tutorial explains how Apollo GraphOS and the GraphQL @defer directive can improve perceived performance in media applications. Essential data can render first, while ratings, reviews, and recommendations load progressively as they become available.

### Source excerpt

This post is a part of our "How to power modern media apps with Apollo GraphOS" series. Also in this series: - Enable omnichannel experiences - Manage versions of your API for third-parties - Providing real-time data for consumers For nearly all media companies, performance is a critical feature. Providing a user experience which comes as close to instant as the holy grail.

## Fullstack GraphQL tutorial: @defer and Apollo GraphOS

DevFeed: [Fullstack GraphQL tutorial: @defer and Apollo GraphOS](<https://devfeed.tech/articles/fullstack-graphql-tutorial-defer-and-apollo-graphos-23309.md>)

Original publisher: [Read original article](<https://www.apollographql.com/blog/fullstack-graphql-tutorial-defer-and-apollo-graphos>)

Author: Michael Watson

Published: 2022-11-10T11:46:40Z

Content type: tutorial

Language: en

Sources: [Apollo Blog](<https://devfeed.tech/sources/apollo-blog.md>)

Topics: [GraphOS](<https://devfeed.tech/topics/graphos.md>), [GraphQL](<https://devfeed.tech/topics/graphql.md>), [Tutorial](<https://devfeed.tech/topics/tutorial.md>), [API](<https://devfeed.tech/topics/api.md>), [Development](<https://devfeed.tech/topics/development.md>)

Tags: [apollo](<https://devfeed.tech/tags/apollo.md>), [apollo-federation](<https://devfeed.tech/tags/apollo-federation.md>), [caching](<https://devfeed.tech/tags/caching.md>), [defer](<https://devfeed.tech/tags/defer.md>), [graphos](<https://devfeed.tech/tags/graphos.md>), [graphql](<https://devfeed.tech/tags/graphql.md>), [latency](<https://devfeed.tech/tags/latency.md>), [time-to-interactive](<https://devfeed.tech/tags/time-to-interactive.md>), [tutorial](<https://devfeed.tech/tags/tutorial.md>), [user-experience](<https://devfeed.tech/tags/user-experience.md>)

### AI overview

This tutorial explains how to use GraphQL's @defer directive with Apollo GraphOS to deliver slow parts of a query asynchronously and improve client time-to-interactive. It covers connecting a GraphQL API to a GraphOS supergraph and defining entities with Apollo Federation.

### Source excerpt

With Apollo GraphOS, you can improve your client app's time-to-interactive (TTI) and reduce latency in a few lines of code. Just plug your GraphQL API into the supergraph and add the directive to the slow parts of your GraphQL query. When you mark slow fields with , the supergraph knows it can deliver those parts of the result asynchronously. The directive is a proposal to the GraphQL specification that has been in development since July 2020.

## $q.defer: You're doing it wrong

DevFeed: [$q.defer: You're doing it wrong](<https://devfeed.tech/articles/q-defer-you-re-doing-it-wrong-21259.md>)

Original publisher: [Read original article](<https://juri.dev/blog/2015/09/link-angular-defer/>)

Published: 2015-09-24T00:00:00Z

Content type: opinion

Language: en

Sources: [Juri Strumpflohner](<https://devfeed.tech/sources/juri-strumpflohner.md>)

Topics: [Angular](<https://devfeed.tech/topics/angular.md>), [Promise](<https://devfeed.tech/topics/promise.md>)

Tags: [angular](<https://devfeed.tech/tags/angular.md>), [article](<https://devfeed.tech/tags/article.md>), [callback](<https://devfeed.tech/tags/callback.md>), [defer](<https://devfeed.tech/tags/defer.md>)

### AI overview

An article discusses common mistakes when using Angular deferreds and promises, recommending simple deferrals for simple cases, promise chaining when possible, and custom deferreds when wrapping callback-based APIs.

### Source excerpt

Lorem ipsum dolor sit amet

## Understanding Defer, Panic and Recover

DevFeed: [Understanding Defer, Panic and Recover](<https://devfeed.tech/articles/understanding-defer-panic-and-recover-22053.md>)

Original publisher: [Read original article](<https://www.ardanlabs.com/blog/2013/06/understanding-defer-panic-and-recover.html>)

Published: 2013-06-08T00:00:00Z

Content type: tutorial

Language: en

Sources: [William Kennedy](<https://devfeed.tech/sources/william-kennedy.md>)

Topics: [Go Language](<https://devfeed.tech/topics/go-language.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [ardan-labs](<https://devfeed.tech/tags/ardan-labs.md>), [blog](<https://devfeed.tech/tags/blog.md>), [code](<https://devfeed.tech/tags/code.md>), [defer](<https://devfeed.tech/tags/defer.md>), [error-interface](<https://devfeed.tech/tags/error-interface.md>), [function](<https://devfeed.tech/tags/function.md>), [go](<https://devfeed.tech/tags/go.md>), [go-programming](<https://devfeed.tech/tags/go-programming.md>), [golang](<https://devfeed.tech/tags/golang.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [programming](<https://devfeed.tech/tags/programming.md>)

### AI overview

This tutorial explains how Go's defer mechanism works, including how a deferred function runs when its containing function ends and can access captured state through a closure. It introduces defer, panic, and recover as the basis for try/catch-like protection in Go applications.

### Source excerpt

I am building my TraceLog package and it is really important that the package logs any internal exceptions and prevents panics from shutting down the application. The TraceLog package must never be responsible for shutting down an application. I also have internal go routines that must never terminate until the application is shut down gracefully. Understanding how to use Defer and Recover in your application can be a bit tricky at first, especially if you are used to using try/catch blocks. There is a pattern you can implement to provide that same type of try/catch protection in Go. Before I can show you this you need to learn how Defer, Panic and Recover work. First you need to understand the intricacies of the keyword defer. Start with this piece of code: package main import ( "fmt" ) func main() { test() } func mimicError(key string) error { return fmt.Errorf("Mimic Error : %s", key) } func test() { fmt.Println("Start Test") err := mimicError("1") defer func() { fmt.Println("Start Defer") if err != nil { fmt.Println("Defer Error:", err) } }() fmt.Println("End Test") } The MimicError function is a test function that will be used to simulate an error. It is following the Go convention of using the error type to return an indication if something went wrong. In Go the error type is defined as an interface: type error interface { Error() string } If you don't understand what a Go interface is at the moment then this might help for now. Any type that implements the Error() function implements this interface and can be used as a variable of this type. The MimicError function is using errors.New(string) to create an error type variable. The errors type can be found in the errors package. Test function produces the following output: Start Test End Test Start Defer Defer Error : Mimic Error : 1 When you study the output you see that the Test function started and ended. Then right before the Test function terminated for good, the inline defer function was called. Two inter

## Piwik: śledzenie asynchroniczne + logowanie ksywy komentującego w WordPress'ie

DevFeed: [Piwik: śledzenie asynchroniczne + logowanie ksywy komentującego w WordPress'ie](<https://devfeed.tech/articles/piwik-sledzenie-asynchroniczne-logowanie-ksywy-komentujacego-w-wordpress-ie-27561.md>)

Original publisher: [Read original article](<https://gagor.pro/2012/12/piwik-sledzenie-asynchroniczne-logowanie-ksywy-komentujacego-w-wordpressie/>)

Author: Tom

Published: 2012-12-21T00:00:00Z

Content type: tutorial

Language: pl

Sources: [Tomasz Gągor](<https://devfeed.tech/sources/tomasz-gagor.md>)

Topics: [WordPress](<https://devfeed.tech/topics/wordpress.md>), [async](<https://devfeed.tech/topics/async.md>), [JavaScript](<https://devfeed.tech/topics/javascript.md>), [Web Development](<https://devfeed.tech/topics/web-development.md>)

Tags: [analytics](<https://devfeed.tech/tags/analytics.md>), [async](<https://devfeed.tech/tags/async.md>), [asynchronous](<https://devfeed.tech/tags/asynchronous.md>), [defer](<https://devfeed.tech/tags/defer.md>), [javascript](<https://devfeed.tech/tags/javascript.md>), [js](<https://devfeed.tech/tags/js.md>), [script](<https://devfeed.tech/tags/script.md>), [wordpress](<https://devfeed.tech/tags/wordpress.md>)

### AI overview

This Polish developer article describes using Piwik with WordPress to track commenters based on the username or nickname stored in the comment field. It also shows how to load the Piwik tracking script asynchronously and set the commenter name as a custom variable.

### Source excerpt

Korzystam z instancji Piwik'a do monitorowania odwiedzin na stronie i postanowiłem pokombinować czy da się w ten sposób monitorować wejścia konkretnych osób na bazie wpisanego w polu komentarza loginu/ksywki. Jak zacząłem grzebać to przy okazji zmieniłem też sposób ładowania skryptów Piwika na asynchroniczny. A leci to mniej więcej tak: <script type="text/javascript"> var i,x,y,ARRcookies=document.cookie.split(";"); var comment_author = ""; for (i=0;i<ARRcookies.length;i++) { x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("=")); y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1); x=x.replace(/^\s+|\s+$/g,""); if (x.indexOf("comment_author") != -1 && x.indexOf("comment_author_email") == -1 && x.indexOf("comment_author_url") == -1) { comment_author = unescape(y); } } var _paq = _paq || []; (function(){ var u=(("https:" == document.location.protocol) ? "https://url.instancji.piwika.pl/" : "http://url.instancji.piwika.pl/"); _paq.push(['setSiteId', 1]); _paq.push(['setTrackerUrl', u+'piwik.php']); _paq.push(['setCustomVariable','1','Author', comment_author]); _paq.push(['trackPageView']); _paq.push(['enableLinkTracking']); var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.type='text/javascript'; g.defer=true; g.async=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s); })(); </script> Źródło http://piwik.org/docs/javascript-tracking/#toc-asynchronous-tracking external link http://codex.wordpress.org/WordPress_Cookies#Commenters external link