Skip to content
Prev Previous commit
Next Next commit
Update async operation pattern to *LastResult in style guide
  • Loading branch information
google-labs-jules[bot] committed Jun 23, 2025
commit bfec241b91e545ab6db9afbda3ad57c9e73148f5
6 changes: 3 additions & 3 deletions STYLE_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ complexity, especially when part of it is reflected in external code:
### Application Initiated Async Operations

* Use the Future / State Pattern.
* Add a `*Result()` method for each async operation method to allow the caller
* Add a `*LastResult()` method for each async operation method to allow the caller
to poll and not save state.

e.g.
Expand All @@ -288,7 +288,7 @@ e.g.
// Start async operation.
Future<SignInWithCrendentialResult> SignInWithCredential(...);
// Get the result of the pending / last async operation for the method.
Future<SignInWithCrendentialResult> GetSignInWithCredentialResult();
Future<SignInWithCrendentialResult> SignInWithCredentialLastResult();

Usage examples:
// call and register callback
Expand All @@ -304,7 +304,7 @@ e.g.

// call and poll #2 (result stored in API)
SignInWithCredential();
while (GetSignInWithCredentialResult().value() != kComplete) {
while (SignInWithCredentialLastResult().value() != kComplete) {
}
```

Expand Down