notify

package module
v1.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 26, 2022 License: MIT Imports: 3 Imported by: 2

README

go-notify

Example

package main

import (
	"log"

	notify "github.com/arturoeanton/go-notify"
)

func main() {
	data := make(chan string)
	fx := func(observer *notify.ObserverNotify, event *notify.Event) {
		log.Println(observer.Filename, "  ", event.Name, "  ", event.Op.String())
	}

	notify.NewObserverNotify("./", "test.txt").
		FxCreate(fx).
		FxWrite(fx).
		FxChmod(fx).
		FxRemove(fx).
		FxRename(fx).
		Run()

	<-data
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event added in v1.0.3

type Event fsnotify.Event

type ObserverNotify

type ObserverNotify struct {
	Filename     string
	Directory    string
	Watcher      *fsnotify.Watcher
	CurrentEvent *fsnotify.Event
	// contains filtered or unexported fields
}

func NewObserverNotify

func NewObserverNotify(directory string, filename string) *ObserverNotify

func (*ObserverNotify) FxChmod

func (o *ObserverNotify) FxChmod(fxChmod func(observer *ObserverNotify, event *Event)) *ObserverNotify

func (*ObserverNotify) FxCreate

func (o *ObserverNotify) FxCreate(fxCreate func(observer *ObserverNotify, event *Event)) *ObserverNotify

func (*ObserverNotify) FxRemove

func (o *ObserverNotify) FxRemove(fxRemove func(observer *ObserverNotify, event *Event)) *ObserverNotify

func (*ObserverNotify) FxRename

func (o *ObserverNotify) FxRename(fxRename func(observer *ObserverNotify, event *Event)) *ObserverNotify

func (*ObserverNotify) FxWrite

func (o *ObserverNotify) FxWrite(fxWrite func(observer *ObserverNotify, event *Event)) *ObserverNotify

func (*ObserverNotify) Run

func (o *ObserverNotify) Run()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL