mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-02 22:49:31 +08:00
20 lines
331 B
Go
20 lines
331 B
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
)
|
|
|
|
type Service struct {
|
|
}
|
|
|
|
// A long running operation of specified duration.
|
|
func (*Service) LongRunning(ctx context.Context, milliseconds int) error {
|
|
select {
|
|
case <-time.After(time.Duration(milliseconds) * time.Millisecond):
|
|
return nil
|
|
case <-ctx.Done():
|
|
return ctx.Err()
|
|
}
|
|
}
|