Discover Packages
github.com/CodeSyncr/nimbus-native
plugins
lightsensor
package
Version:
v0.0.14
Opens a new window with list of versions in this module.
Published: Nov 10, 2026
License: MIT
Opens a new window with license information.
Imports: 3
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
Documentation
¶
Package lightsensor reads how bright it is around the phone. It's Android
only: iOS doesn't let apps read this sensor.
nimbus native plugin add light-sensor
go lightsensor.Watch(ctx, 2, func(r lightsensor.Reading) { setDim(r.Lux < 10) })
Available reports whether this phone has the sensor.
Watch calls f about hz times a second until ctx ends. It blocks, so run it
from a goroutine in an effect. Where there's no sensor it fails with
plugin.Unavailable.
type Reading struct {
Lux float64 `json:"lux"`
}
Reading is one sample.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.