You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 30, 2025. It is now read-only.
Introducing some helpers can make adding Async API supporting code and tests easier. Another reason for doing this change is the k6 promise API is still experimental, and its API can change (see this).
k6ext.Promise
This helper makes it easier to switch our sync API to async.
returnk6ext.Promise(b.ctx, func() (interface{}, error) {
select {
case<-b.browserProc.lostConnection:
// resolves the promise with the value truereturntrue, nilcase<-b.ctx.Done():
// rejects the promise with the error with the given errorreturnnil, fmt.Errorf("browser.on promise rejected: %w", b.ctx.Err())
}
})
k6ext.AbortingPromise
There can also be an AbortingPromise that will allow aborting the event loop when an error occurs. It's not clear whether we're ever going to need this, then again, it doesn't hurt to support it.
The text was updated successfully, but these errors were encountered:
Introducing some helpers can make adding Async API supporting code and tests easier. Another reason for doing this change is the k6 promise API is still experimental, and its API can change (see this).
k6ext.Promise
This helper makes it easier to switch our sync API to async.
Before:
After:
k6ext.AbortingPromise
There can also be an
AbortingPromise
that will allow aborting the event loop when an error occurs. It's not clear whether we're ever going to need this, then again, it doesn't hurt to support it.The text was updated successfully, but these errors were encountered: