~whereswaldon/haptic

ref: 78675dee81dd haptic/haptic_default.go -rw-r--r-- 1.1 KiB
78675deeChris Waldon deps: update to depend on latest gio 1 year, 9 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//+build !android

package haptic

import "gioui.org/app"

// Buzzer provides methods to trigger haptic feedback. On OSes other than android,
// all methods are no-ops.
type Buzzer struct {
}

// Buzz attempts to trigger a haptic vibration without blocking. It returns whether
// or not it was successful. If it returns false, it is safe to retry. On unsupported
// platforms, it always returns true.
func (b *Buzzer) Buzz() bool {
	return true
}

// Update does nothing on platforms other than Android. See the documentation with
// GOOS=android for information on using this method correctly on that platform.
func (b *Buzzer) SetView(_ uintptr) {
}

// Shutdown stops the background event loop that interfaces with the JVM.
// Call this when you are done with a Buzzer to allow it to be garbage
// collected. Do not call this method more than per Buzzer.
func (b *Buzzer) Shutdown() {
}

// Errors returns a channel of errors from trying to interface with the JVM. This
// channel will close when Shutdown() is invoked.
func (b *Buzzer) Errors() <-chan error {
	return nil
}

// NewBuzzer constructs a buzzer.
func NewBuzzer(_ *app.Window) *Buzzer {
	return &Buzzer{}
}