本文整理汇总了Golang中github.com/cortesi/devd/livereload.Reloader类的典型用法代码示例。如果您正苦于以下问题:Golang Reloader类的具体用法?Golang Reloader怎么用?Golang Reloader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Reloader类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: WatchPaths
// WatchPaths watches a set of paths, and broadcasts changes through reloader.
func WatchPaths(paths, excludePatterns []string, reloader livereload.Reloader, log termlog.Logger) error {
ch := make(chan []string, 1)
for _, path := range paths {
absPath, err := filepath.Abs(path)
if err != nil {
return err
}
if absPath[len(absPath)-1] != filepath.Separator {
absPath += string(filepath.Separator)
}
pathchan := make(chan []string, 1)
err = watch.Watch(path, batchTime, pathchan)
if err != nil {
return err
}
go func() {
for files := range pathchan {
files = filterFiles(absPath, files, excludePatterns, log)
if len(files) > 0 {
ch <- files
}
}
}()
}
go reloader.Watch(ch)
return nil
}
示例2: WatchRoutes
// WatchRoutes watches the route collection, and broadcasts changes through reloader.
func WatchRoutes(routes RouteCollection, reloader livereload.Reloader, excludePatterns []string, log termlog.Logger) error {
c := make(chan []string, 1)
for i := range routes {
err := routes[i].Watch(c, excludePatterns, log)
if err != nil {
return err
}
}
go reloader.Watch(c)
return nil
}
示例3: WatchPaths
// WatchPaths watches a set of paths, and broadcasts changes through reloader.
func WatchPaths(paths, excludePatterns []string, reloader livereload.Reloader, log termlog.Logger) error {
ch := make(chan []string, 1)
for _, path := range paths {
modchan := make(chan modd.Mod, 1)
err := modd.Watch([]string{path}, excludePatterns, batchTime, modchan)
if err != nil {
return err
}
go func() {
for mod := range modchan {
ch <- mod.All()
}
}()
}
go reloader.Watch(ch)
return nil
}
示例4: WatchPaths
// WatchPaths watches a set of paths, and broadcasts changes through reloader.
func WatchPaths(paths, excludePatterns []string, reloader livereload.Reloader, log termlog.Logger) error {
ch := make(chan []string, 1)
for _, path := range paths {
modchan := make(chan modd.Mod, 1)
err := modd.Watch(path, batchTime, modchan)
if err != nil {
return err
}
go func() {
for mod := range modchan {
files := filterFiles(mod.All(), excludePatterns, log)
if len(files) > 0 {
ch <- files
}
}
}()
}
go reloader.Watch(ch)
return nil
}
示例5: WatchPaths
// WatchPaths watches a set of paths, and broadcasts changes through reloader.
func WatchPaths(paths, excludePatterns []string, reloader livereload.Reloader, log termlog.Logger) error {
ch := make(chan []string, 1)
for _, path := range paths {
modchan := make(chan *moddwatch.Mod, 1)
_, err := moddwatch.Watch([]string{path}, batchTime, modchan)
if err != nil {
return err
}
go func() {
for mod := range modchan {
filteredMod, err := mod.Filter([]string{"**/*"}, excludePatterns)
if err != nil {
log.Shout("Error filtering watches: %s", err)
}
if !filteredMod.Empty() {
ch <- filteredMod.All()
}
}
}()
}
go reloader.Watch(ch)
return nil
}