Skip to content

Commit

Permalink
Merge pull request #4 from prashantgupta24/readme-patch
Browse files Browse the repository at this point in the history
updated readme
  • Loading branch information
prashantgupta24 authored Apr 3, 2019
2 parents 3b108b4 + 75d2e18 commit 303b016
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,20 @@ This libary notifies through a channel whenever your machine is put to sleep or
## Usage

```go
notifierCh := notifier.GetInstance().Start()
notifierCh := notifier.GetInstance().Start()

for {
select {
case activity := <-notifierCh:
if activity.Type == notifier.Awake {
log.Println("machine awake")
} else {
if activity.Type == notifier.Sleep {
log.Println("machine sleeping")
}
for {
select {
case activity := <-notifierCh:
if activity.Type == notifier.Awake {
log.Println("machine awake")
} else {
if activity.Type == notifier.Sleep {
log.Println("machine sleeping")
}
}
}
```
}
```
## Example
See example [here](https://github.com/prashantgupta24/mac-sleep-notifier/blob/master/example/example.go)

0 comments on commit 303b016

Please # to comment.