本文整理汇总了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
}
开发者ID:wzugang,项目名称:devd,代码行数:29,代码来源:watch.go
示例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
}
开发者ID:wzugang,项目名称:devd,代码行数:12,代码来源:watch.go
示例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
}
开发者ID:Ezmyrelda,项目名称:devd,代码行数:18,代码来源:watch.go
示例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
}
开发者ID:roryokane,项目名称:devd,代码行数:21,代码来源:watch.go
示例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
}
开发者ID:cortesi,项目名称:devd,代码行数:24,代码来源:watch.go
注:本文中的github.com/cortesi/devd/livereload.Reloader类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论